diff options
author | Jose <jose@zeroc.com> | 2018-06-28 15:46:50 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2018-06-28 15:46:50 +0200 |
commit | b3763409f91afc54bf8f014d6e92772d6fc34dcb (patch) | |
tree | cdefc610ff161953073337ce0503e505078b4f9a /csharp/test | |
parent | Fixed dispatcher test hang (fixes #123) (diff) | |
download | ice-b3763409f91afc54bf8f014d6e92772d6fc34dcb.tar.bz2 ice-b3763409f91afc54bf8f014d6e92772d6fc34dcb.tar.xz ice-b3763409f91afc54bf8f014d6e92772d6fc34dcb.zip |
Add support cs:namespace metadata
Add support to map Slice modules to different namespaces
using cs:namespace metadata
Fixes #122 slice2cs generates invalid namespace qualification
Diffstat (limited to 'csharp/test')
-rw-r--r-- | csharp/test/Ice/packagemd/.gitignore | 7 | ||||
-rw-r--r-- | csharp/test/Ice/packagemd/AllTests.cs | 176 | ||||
-rw-r--r-- | csharp/test/Ice/packagemd/Client.cs | 38 | ||||
-rw-r--r-- | csharp/test/Ice/packagemd/InitialI.cs | 86 | ||||
-rw-r--r-- | csharp/test/Ice/packagemd/NoPackage.ice | 39 | ||||
-rw-r--r-- | csharp/test/Ice/packagemd/Package.ice | 59 | ||||
-rw-r--r-- | csharp/test/Ice/packagemd/Server.cs | 40 | ||||
-rw-r--r-- | csharp/test/Ice/packagemd/Test.ice | 39 | ||||
-rw-r--r-- | csharp/test/Ice/packagemd/msbuild/client/net45/client.csproj | 108 | ||||
-rw-r--r-- | csharp/test/Ice/packagemd/msbuild/client/netstandard2.0/client.csproj | 55 | ||||
-rw-r--r-- | csharp/test/Ice/packagemd/msbuild/server/net45/server.csproj | 106 | ||||
-rw-r--r-- | csharp/test/Ice/packagemd/msbuild/server/netstandard2.0/server.csproj | 55 | ||||
-rw-r--r-- | csharp/test/Ice/scope/AllTests.cs | 83 | ||||
-rw-r--r-- | csharp/test/Ice/scope/Server.cs | 65 | ||||
-rw-r--r-- | csharp/test/Ice/scope/Test.ice | 26 |
15 files changed, 978 insertions, 4 deletions
diff --git a/csharp/test/Ice/packagemd/.gitignore b/csharp/test/Ice/packagemd/.gitignore new file mode 100644 index 00000000000..67872faa673 --- /dev/null +++ b/csharp/test/Ice/packagemd/.gitignore @@ -0,0 +1,7 @@ +// Generated by makegitignore.py + +// IMPORTANT: Do not edit this file -- any edits made here will be lost! +client +server +Test.cpp +Test.h diff --git a/csharp/test/Ice/packagemd/AllTests.cs b/csharp/test/Ice/packagemd/AllTests.cs new file mode 100644 index 00000000000..2f8defa7a92 --- /dev/null +++ b/csharp/test/Ice/packagemd/AllTests.cs @@ -0,0 +1,176 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +using System; +using Test; + +public class AllTests : Test.AllTests +{ + public static InitialPrx allTests(TestHelper helper) + { + var communicator = helper.communicator(); + Console.Out.Write("testing stringToProxy... "); + Console.Out.Flush(); + var @base = communicator.stringToProxy("initial:" + helper.getTestEndpoint(0)); + test(@base != null); + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing checked cast... "); + Console.Out.Flush(); + var initial = InitialPrxHelper.checkedCast(@base); + test(initial != null); + test(initial.Equals(@base)); + Console.Out.WriteLine("ok"); + + { + Console.Out.Write("testing types without package... "); + Console.Out.Flush(); + test.Ice.packagemd.Test1.C1 c1 = initial.getTest1C2AsC1(); + test(c1 != null); + test(c1 is test.Ice.packagemd.Test1.C2); + test.Ice.packagemd.Test1.C2 c2 = initial.getTest1C2AsC2(); + test(c2 != null); + try + { + initial.throwTest1E2AsE1(); + test(false); + } + catch(test.Ice.packagemd.Test1.E1 ex) + { + test(ex is test.Ice.packagemd.Test1.E2); + } + try + { + initial.throwTest1E2AsE2(); + test(false); + } + catch(test.Ice.packagemd.Test1.E2) + { + // Expected + } + try + { + initial.throwTest1Notify(); + test(false); + } + catch(test.Ice.packagemd.Test1.@notify) + { + // Expected + } + Console.Out.WriteLine("ok"); + } + + { + Console.Out.Write("testing types with package... "); + Console.Out.Flush(); + + { + try + { + initial.throwTest2E2AsE1(); + test(false); + } + catch(Ice.UnknownUserException) + { + // Expected + } + catch(Ice.MarshalException) + { + // Expected + } + catch(test.Ice.packagemd.testpkg.Test2.E1) + { + test(false); + } + try + { + initial.throwTest2E2AsE2(); + test(false); + } + catch(Ice.UnknownUserException) + { + // Expected + } + catch(Ice.MarshalException) + { + // Expected + } + catch(test.Ice.packagemd.testpkg.Test2.E1) + { + test(false); + } + } + + { + // + // Define Ice.Package.Test2=testpkg and try again. + // + communicator.getProperties().setProperty("Ice.Package.Test2", "test.Ice.packagemd.testpkg"); + test.Ice.packagemd.testpkg.Test2.C1 c1 = initial.getTest2C2AsC1(); + test(c1 != null); + test(c1 is test.Ice.packagemd.testpkg.Test2.C2); + test.Ice.packagemd.testpkg.Test2.C2 c2 = initial.getTest2C2AsC2(); + test(c2 != null); + try + { + initial.throwTest2E2AsE1(); + test(false); + } + catch (test.Ice.packagemd.testpkg.Test2.E1 ex) + { + test(ex is test.Ice.packagemd.testpkg.Test2.E2); + } + try + { + initial.throwTest2E2AsE2(); + test(false); + } + catch(test.Ice.packagemd.testpkg.Test2.E2) + { + // Expected + } + } + + { + // + // Define Ice.Default.Package=testpkg and try again. We can't retrieve + // the Test2.* types again (with this communicator) because factories + // have already been cached for them, so now we use the Test3.* types. + // + communicator.getProperties().setProperty("Ice.Default.Package", "test.Ice.packagemd.modpkg"); + test.Ice.packagemd.modpkg.Test3.C1 c1 = initial.getTest3C2AsC1(); + test(c1 != null); + test(c1 is test.Ice.packagemd.modpkg.Test3.C2); + test.Ice.packagemd.modpkg.Test3.C2 c2 = initial.getTest3C2AsC2(); + test(c2 != null); + try + { + initial.throwTest3E2AsE1(); + test(false); + } + catch (test.Ice.packagemd.modpkg.Test3.E1 ex) + { + test(ex is test.Ice.packagemd.modpkg.Test3.E2); + } + try + { + initial.throwTest3E2AsE2(); + test(false); + } + catch (test.Ice.packagemd.modpkg.Test3.E2) + { + // Expected + } + } + + Console.Out.WriteLine("ok"); + } + return initial; + } +} diff --git a/csharp/test/Ice/packagemd/Client.cs b/csharp/test/Ice/packagemd/Client.cs new file mode 100644 index 00000000000..b7897cfff2b --- /dev/null +++ b/csharp/test/Ice/packagemd/Client.cs @@ -0,0 +1,38 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +using System; +using System.Reflection; + +[assembly: CLSCompliant(true)] + +[assembly: AssemblyTitle("IceTest")] +[assembly: AssemblyDescription("Ice test")] +[assembly: AssemblyCompany("ZeroC, Inc.")] + +public class Client : Test.TestHelper +{ + override public void run(string[] args) + { + Ice.Properties properties = createTestProperties(ref args); + properties.setProperty("Ice.Warn.Dispatch", "0"); + properties.setProperty("Ice.Package.Test", "test.Ice.packagemd"); + properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd"); + using (var communicator = initialize(properties)) + { + var initial = AllTests.allTests(this); + initial.shutdown(); + } + } + + public static int Main(string[] args) + { + return Test.TestDriver.runTest<Client>(args); + } +} diff --git a/csharp/test/Ice/packagemd/InitialI.cs b/csharp/test/Ice/packagemd/InitialI.cs new file mode 100644 index 00000000000..ca20779453c --- /dev/null +++ b/csharp/test/Ice/packagemd/InitialI.cs @@ -0,0 +1,86 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +using Ice; +using test.Ice.packagemd.modpkg.Test3; +using test.Ice.packagemd.Test1; +using test.Ice.packagemd.testpkg.Test2; + +public class InitialI : Test.InitialDisp_ +{ + public override test.Ice.packagemd.Test1.C1 getTest1C2AsC1(Current current = null) + { + return new test.Ice.packagemd.Test1.C2(); + } + + public override test.Ice.packagemd.Test1.C2 getTest1C2AsC2(Current current = null) + { + return new test.Ice.packagemd.Test1.C2(); + } + + public override test.Ice.packagemd.testpkg.Test2.C1 getTest2C2AsC1(Current current = null) + { + return new test.Ice.packagemd.testpkg.Test2.C2(); + } + + public override test.Ice.packagemd.testpkg.Test2.C2 getTest2C2AsC2(Current current = null) + { + return new test.Ice.packagemd.testpkg.Test2.C2(); + } + + public override test.Ice.packagemd.modpkg.Test3.C1 getTest3C2AsC1(Current current = null) + { + return new test.Ice.packagemd.modpkg.Test3.C2(); + } + + public override test.Ice.packagemd.modpkg.Test3.C2 getTest3C2AsC2(Current current = null) + { + return new test.Ice.packagemd.modpkg.Test3.C2(); + } + + public override void shutdown(Current current = null) + { + current.adapter.getCommunicator().shutdown(); + } + + public override void throwTest1E2AsE1(Current current = null) + { + throw new test.Ice.packagemd.Test1.E2(); + } + + public override void throwTest1E2AsE2(Current current = null) + { + throw new test.Ice.packagemd.Test1.E2(); + } + + public override void throwTest1Notify(Current current = null) + { + throw new test.Ice.packagemd.Test1.@notify(); + } + + public override void throwTest2E2AsE1(Current current = null) + { + throw new test.Ice.packagemd.testpkg.Test2.E2(); + } + + public override void throwTest2E2AsE2(Current current = null) + { + throw new test.Ice.packagemd.testpkg.Test2.E2(); + } + + public override void throwTest3E2AsE1(Current current = null) + { + throw new test.Ice.packagemd.modpkg.Test3.E2(); + } + + public override void throwTest3E2AsE2(Current current = null) + { + throw new test.Ice.packagemd.modpkg.Test3.E2(); + } +} diff --git a/csharp/test/Ice/packagemd/NoPackage.ice b/csharp/test/Ice/packagemd/NoPackage.ice new file mode 100644 index 00000000000..f3bc2476bf4 --- /dev/null +++ b/csharp/test/Ice/packagemd/NoPackage.ice @@ -0,0 +1,39 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#pragma once + +[["cs:namespace:test.Ice.packagemd"]] +module Test1 +{ +class C1 +{ + int i; +} + +class C2 extends C1 +{ + long l; +} + +exception E1 +{ + int i; +} + +exception E2 extends E1 +{ + long l; +} + +exception notify /* Test keyword escape. */ +{ + int i; +} +} diff --git a/csharp/test/Ice/packagemd/Package.ice b/csharp/test/Ice/packagemd/Package.ice new file mode 100644 index 00000000000..7987773ead2 --- /dev/null +++ b/csharp/test/Ice/packagemd/Package.ice @@ -0,0 +1,59 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#pragma once + +[["cs:namespace:test.Ice.packagemd.testpkg"]] + +module Test2 +{ +class C1 +{ + int i; +} + +class C2 extends C1 +{ + long l; +} + +exception E1 +{ + int i; +} + +exception E2 extends E1 +{ + long l; +} +} + +["cs:namespace:test.Ice.packagemd.modpkg"] +module Test3 +{ +class C1 +{ + int i; +} + +class C2 extends C1 +{ + long l; +} + +exception E1 +{ + int i; +} + +exception E2 extends E1 +{ + long l; +} +} diff --git a/csharp/test/Ice/packagemd/Server.cs b/csharp/test/Ice/packagemd/Server.cs new file mode 100644 index 00000000000..bf5252fc4fb --- /dev/null +++ b/csharp/test/Ice/packagemd/Server.cs @@ -0,0 +1,40 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +using System; +using System.Reflection; + +[assembly: CLSCompliant(true)] + +[assembly: AssemblyTitle("IceTest")] +[assembly: AssemblyDescription("Ice test")] +[assembly: AssemblyCompany("ZeroC, Inc.")] + +public class Server : Test.TestHelper +{ + public override void run(string[] args) + { + Ice.Properties properties = createTestProperties(ref args); + properties.setProperty("Ice.Package.Test", "test.Ice.packagemd"); + properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd"); + using (var communicator = initialize(properties)) + { + properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + var adapter = communicator.createObjectAdapter("TestAdapter"); + adapter.add(new InitialI(), Ice.Util.stringToIdentity("initial")); + adapter.activate(); + communicator.waitForShutdown(); + } + } + + public static int Main(string[] args) + { + return Test.TestDriver.runTest<Server>(args); + } +} diff --git a/csharp/test/Ice/packagemd/Test.ice b/csharp/test/Ice/packagemd/Test.ice new file mode 100644 index 00000000000..01fbbec0e16 --- /dev/null +++ b/csharp/test/Ice/packagemd/Test.ice @@ -0,0 +1,39 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#pragma once + +#include <Package.ice> +#include <NoPackage.ice> + +module Test +{ + +interface Initial +{ + Test1::C1 getTest1C2AsC1(); + Test1::C2 getTest1C2AsC2(); + void throwTest1E2AsE1() throws Test1::E1; + void throwTest1E2AsE2() throws Test1::E2; + void throwTest1Notify() throws Test1::notify; + + Test2::C1 getTest2C2AsC1(); + Test2::C2 getTest2C2AsC2(); + void throwTest2E2AsE1() throws Test2::E1; + void throwTest2E2AsE2() throws Test2::E2; + + Test3::C1 getTest3C2AsC1(); + Test3::C2 getTest3C2AsC2(); + void throwTest3E2AsE1() throws Test3::E1; + void throwTest3E2AsE2() throws Test3::E2; + + void shutdown(); +} + +} diff --git a/csharp/test/Ice/packagemd/msbuild/client/net45/client.csproj b/csharp/test/Ice/packagemd/msbuild/client/net45/client.csproj new file mode 100644 index 00000000000..dfb65a2dcc6 --- /dev/null +++ b/csharp/test/Ice/packagemd/msbuild/client/net45/client.csproj @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build" ToolsVersion="14.0"> + <Import Project="..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.props" Condition="Exists('..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.props')" /> + <Import Condition="Exists('..\..\..\..\..\..\msbuild\\packages\zeroc.ice.net.3.7.1\build\zeroc.ice.net.props') and '$(ICE_BIN_DIST)' == 'all'" Project="..\..\..\..\..\..\msbuild\packages\zeroc.ice.net.3.7.1\build\zeroc.ice.net.props" /> + <PropertyGroup Label="Globals"> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> + <ProjectTypeGuids>{28993779-3132-408A-BCB0-1D78225F4824};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> + <NoWarn>3005</NoWarn> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'"> + <NoWarn>3005</NoWarn> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> + <NoWarn>3005</NoWarn> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> + <NoWarn>3005</NoWarn> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'"> + <NoWarn>3005</NoWarn> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> + <NoWarn>3005</NoWarn> + </PropertyGroup> + <Import Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{2BB1FE54-54EF-4974-9F5D-ABFEC740AE29}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <AssemblyName>client</AssemblyName> + <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <OutputPath>$(MSBuildThisFileDirectory)</OutputPath> + <DebugSymbols>true</DebugSymbols> + </PropertyGroup> + <ItemDefinitionGroup Label="IceBuilder"> + <SliceCompile> + <OutputDir>$(MSBuildProjectDirectory)\generated</OutputDir> + <IncludeDirectories>..\..\..</IncludeDirectories> + <AdditionalOptions> + </AdditionalOptions> + </SliceCompile> + </ItemDefinitionGroup> + <ItemGroup> + <Reference Include="Ice, Version=3.7.1.0, Culture=neutral, PublicKeyToken=0c5ebb72d74932c6, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <Private>False</Private> + <HintPath>$(IceAssembliesDir)\net45\Ice.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="Microsoft.CSharp" /> + </ItemGroup> + <ItemGroup> + <Folder Include="Properties\" /> + </ItemGroup> + <ItemGroup> + <Compile Include="..\..\..\..\..\TestCommon\TestHelper.cs"> + <Link>TestHelper.cs</Link> + </Compile> + <Compile Include="..\..\..\AllTests.cs"> + <Link>AllTests.cs</Link> + </Compile> + <Compile Include="..\..\..\Client.cs"> + <Link>Client.cs</Link> + </Compile> + <Compile Include="generated\NoPackage.cs"> + <SliceCompileSource>..\..\..\NoPackage.ice</SliceCompileSource> + </Compile> + <Compile Include="generated\Package.cs"> + <SliceCompileSource>..\..\..\Package.ice</SliceCompileSource> + </Compile> + <Compile Include="generated\Test.cs" /> + </ItemGroup> + <ItemGroup> + <SliceCompile Include="..\..\..\Test.ice"> + <Link>Test.ice</Link> + </SliceCompile> + <None Include="client.exe.config" /> + <None Include="packages.config"> + <SubType>Designer</SubType> + </None> + </ItemGroup> + <ItemGroup> + <SliceCompile Include="..\..\..\NoPackage.ice"> + <Link>NoPackage.ice</Link> + </SliceCompile> + <SliceCompile Include="..\..\..\Package.ice"> + <Link>Package.ice</Link> + </SliceCompile> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <Import Project="$(MSBuildThisFileDirectory)\..\..\..\..\..\..\msbuild\ice.test.props" /> + <Target BeforeTargets="PrepareForBuild" Name="EnsureNuGetPackageBuildImports"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\..\..\..\..\..\msbuild\packages\zeroc.ice.net.3.7.1\build\zeroc.ice.net.props') and '$(ICE_BIN_DIST)' == 'all'" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\..\msbuild\\packages\zeroc.ice.net.3.7.1\build\zeroc.ice.net.props'))" /> + <Error Condition="!Exists('..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.props'))" /> + <Error Condition="!Exists('..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.targets'))" /> + </Target> + <Import Project="..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.targets" Condition="Exists('..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.targets')" /> +</Project>
\ No newline at end of file diff --git a/csharp/test/Ice/packagemd/msbuild/client/netstandard2.0/client.csproj b/csharp/test/Ice/packagemd/msbuild/client/netstandard2.0/client.csproj new file mode 100644 index 00000000000..7234e7e98ad --- /dev/null +++ b/csharp/test/Ice/packagemd/msbuild/client/netstandard2.0/client.csproj @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project Sdk="Microsoft.NET.Sdk"> + <Import Project="../../../../../../msbuild/ice.common.props" /> + <PropertyGroup> + <AssemblyName>client</AssemblyName> + <OutputType>Exe</OutputType> + <TargetFramework>netcoreapp2.0</TargetFramework> + <GenerateAssemblyInfo>false</GenerateAssemblyInfo> + <EnableDefaultCompileItems>false</EnableDefaultCompileItems> + <OutputPath>.</OutputPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> + <NoWarn>1701;1702;3005</NoWarn> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> + <NoWarn>1701;1702;3005</NoWarn> + </PropertyGroup> + <ItemDefinitionGroup Label="IceBuilder"> + <SliceCompile> + <OutputDir>$(MSBuildProjectDirectory)\generated</OutputDir> + <IncludeDirectories>..\..\..</IncludeDirectories> + <AdditionalOptions></AdditionalOptions> + </SliceCompile> + </ItemDefinitionGroup> + <ItemGroup> + <Compile Include="../../../../../TestCommon/TestHelper.cs" /> + <Compile Include="../../../AllTests.cs" /> + <Compile Include="../../../Client.cs" /> + <Compile Include="generated\NoPackage.cs"> + <SliceCompileSource>../../../NoPackage.ice</SliceCompileSource> + </Compile> + <Compile Include="generated\Package.cs"> + <SliceCompileSource>../../../Package.ice</SliceCompileSource> + </Compile> + <Compile Include="generated\Test.cs"> + <SliceCompileSource>../../../Test.ice</SliceCompileSource> + </Compile> + <PackageReference Include="zeroc.icebuilder.msbuild" Version="5.0.4" /> + <SliceCompile Include="../../../Test.ice" /> + <SliceCompile Include="../../../Package.ice" /> + <SliceCompile Include="../../../NoPackage.ice" /> + </ItemGroup> + <Choose> + <When Condition="'$(ICE_BIN_DIST)' == 'all'"> + <ItemGroup> + <PackageReference Include="zeroc.ice.net" Version="3.7.1" /> + </ItemGroup> + </When> + <Otherwise> + <ItemGroup> + <Reference Include="../../../../../../lib/netstandard2.0/Ice.dll" /> + </ItemGroup> + </Otherwise> + </Choose> +</Project> diff --git a/csharp/test/Ice/packagemd/msbuild/server/net45/server.csproj b/csharp/test/Ice/packagemd/msbuild/server/net45/server.csproj new file mode 100644 index 00000000000..80b929a9c6e --- /dev/null +++ b/csharp/test/Ice/packagemd/msbuild/server/net45/server.csproj @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build" ToolsVersion="14.0"> + <Import Project="..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.props" Condition="Exists('..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.props')" /> + <Import Condition="Exists('..\..\..\..\..\..\msbuild\\packages\zeroc.ice.net.3.7.1\build\zeroc.ice.net.props') and '$(ICE_BIN_DIST)' == 'all'" Project="..\..\..\..\..\..\msbuild\packages\zeroc.ice.net.3.7.1\build\zeroc.ice.net.props" /> + <PropertyGroup Label="Globals"> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> + <ProjectTypeGuids>{28993779-3132-408A-BCB0-1D78225F4824};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> + <NoWarn>3005</NoWarn> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'"> + <NoWarn>3005</NoWarn> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> + <NoWarn>3005</NoWarn> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> + <NoWarn>3005</NoWarn> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'"> + <NoWarn>3005</NoWarn> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> + <NoWarn>3005</NoWarn> + </PropertyGroup> + <Import Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{D8F04A5C-9692-4A62-93BD-81483EBEA8F5}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <AssemblyName>server</AssemblyName> + <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <OutputPath>$(MSBuildThisFileDirectory)</OutputPath> + <DebugSymbols>true</DebugSymbols> + </PropertyGroup> + <ItemDefinitionGroup Label="IceBuilder"> + <SliceCompile> + <OutputDir>$(MSBuildProjectDirectory)\generated</OutputDir> + <IncludeDirectories>..\..\..</IncludeDirectories> + <AdditionalOptions> + </AdditionalOptions> + </SliceCompile> + </ItemDefinitionGroup> + <ItemGroup> + <Reference Include="Ice, Version=3.7.1.0, Culture=neutral, PublicKeyToken=0c5ebb72d74932c6, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <Private>False</Private> + <HintPath>$(IceAssembliesDir)\net45\Ice.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="Microsoft.CSharp" /> + </ItemGroup> + <ItemGroup> + <Folder Include="Properties\" /> + </ItemGroup> + <ItemGroup> + <Compile Include="..\..\..\..\..\TestCommon\TestHelper.cs"> + <Link>TestHelper.cs</Link> + </Compile> + <Compile Include="..\..\..\InitialI.cs"> + <Link>InitialI.cs</Link> + </Compile> + <Compile Include="..\..\..\Server.cs"> + <Link>Server.cs</Link> + </Compile> + <Compile Include="generated\NoPackage.cs"> + <SliceCompileSource>..\..\..\NoPackage.ice</SliceCompileSource> + </Compile> + <Compile Include="generated\Package.cs"> + <SliceCompileSource>..\..\..\Package.ice</SliceCompileSource> + </Compile> + <Compile Include="generated\Test.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + <None Include="server.exe.config" /> + <SliceCompile Include="..\..\..\Test.ice"> + <Link>Test.ice</Link> + </SliceCompile> + </ItemGroup> + <ItemGroup> + <SliceCompile Include="..\..\..\NoPackage.ice"> + <Link>NoPackage.ice</Link> + </SliceCompile> + <SliceCompile Include="..\..\..\Package.ice"> + <Link>Package.ice</Link> + </SliceCompile> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <Import Project="$(MSBuildThisFileDirectory)\..\..\..\..\..\..\msbuild\ice.test.props" /> + <Target BeforeTargets="PrepareForBuild" Name="EnsureNuGetPackageBuildImports"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\..\..\..\..\..\msbuild\packages\zeroc.ice.net.3.7.1\build\zeroc.ice.net.props') and '$(ICE_BIN_DIST)' == 'all'" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\..\msbuild\\packages\zeroc.ice.net.3.7.1\build\zeroc.ice.net.props'))" /> + <Error Condition="!Exists('..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.props'))" /> + <Error Condition="!Exists('..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.targets'))" /> + </Target> + <Import Project="..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.targets" Condition="Exists('..\..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.4\build\zeroc.icebuilder.msbuild.targets')" /> +</Project>
\ No newline at end of file diff --git a/csharp/test/Ice/packagemd/msbuild/server/netstandard2.0/server.csproj b/csharp/test/Ice/packagemd/msbuild/server/netstandard2.0/server.csproj new file mode 100644 index 00000000000..11945dde1c1 --- /dev/null +++ b/csharp/test/Ice/packagemd/msbuild/server/netstandard2.0/server.csproj @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project Sdk="Microsoft.NET.Sdk"> + <Import Project="../../../../../../msbuild/ice.common.props" /> + <PropertyGroup> + <AssemblyName>server</AssemblyName> + <OutputType>Exe</OutputType> + <TargetFramework>netcoreapp2.0</TargetFramework> + <GenerateAssemblyInfo>false</GenerateAssemblyInfo> + <EnableDefaultCompileItems>false</EnableDefaultCompileItems> + <OutputPath>.</OutputPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> + <NoWarn>1701;1702;3005</NoWarn> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> + <NoWarn>1701;1702;3005</NoWarn> + </PropertyGroup> + <ItemDefinitionGroup Label="IceBuilder"> + <SliceCompile> + <OutputDir>$(MSBuildProjectDirectory)\generated</OutputDir> + <IncludeDirectories>..\..\..</IncludeDirectories> + <AdditionalOptions></AdditionalOptions> + </SliceCompile> + </ItemDefinitionGroup> + <ItemGroup> + <Compile Include="../../../../../TestCommon/TestHelper.cs" /> + <Compile Include="../../../InitialI.cs" /> + <Compile Include="../../../Server.cs" /> + <Compile Include="generated\NoPackage.cs"> + <SliceCompileSource>../../../NoPackage.ice</SliceCompileSource> + </Compile> + <Compile Include="generated\Package.cs"> + <SliceCompileSource>../../../Package.ice</SliceCompileSource> + </Compile> + <Compile Include="generated\Test.cs"> + <SliceCompileSource>../../../Test.ice</SliceCompileSource> + </Compile> + <PackageReference Include="zeroc.icebuilder.msbuild" Version="5.0.4" /> + <SliceCompile Include="../../../Test.ice" /> + <SliceCompile Include="../../../Package.ice" /> + <SliceCompile Include="../../../NoPackage.ice" /> + </ItemGroup> + <Choose> + <When Condition="'$(ICE_BIN_DIST)' == 'all'"> + <ItemGroup> + <PackageReference Include="zeroc.ice.net" Version="3.7.1" /> + </ItemGroup> + </When> + <Otherwise> + <ItemGroup> + <Reference Include="../../../../../../lib/netstandard2.0/Ice.dll" /> + </ItemGroup> + </Otherwise> + </Choose> +</Project> diff --git a/csharp/test/Ice/scope/AllTests.cs b/csharp/test/Ice/scope/AllTests.cs index 17e4ae4ef32..73ae2a479ca 100644 --- a/csharp/test/Ice/scope/AllTests.cs +++ b/csharp/test/Ice/scope/AllTests.cs @@ -267,6 +267,89 @@ public class AllTests : Test.AllTests } { + Ice.ObjectPrx obj = communicator.stringToProxy("i4:" + helper.getTestEndpoint()); + Inner.Test.Inner2.IPrx i = Inner.Test.Inner2.IPrxHelper.checkedCast(obj); + + Test.S s1 = new Test.S(0); + Test.S s2; + Test.S s3 = i.opS(s1, out s2); + test(s2.Equals(s1)); + test(s3.Equals(s1)); + + Test.S[] sseq1 = new Test.S[] { s1 }; + Test.S[] sseq2; + Test.S[] sseq3 = i.opSSeq(sseq1, out sseq2); + test(sseq2[0].Equals(s1)); + test(sseq3[0].Equals(s1)); + + Dictionary<String, Test.S> smap1 = new Dictionary<String, Test.S>(); + smap1["a"] = s1; + Dictionary<String, Test.S> smap2; + Dictionary<String, Test.S> smap3 = i.opSMap(smap1, out smap2); + test(smap2["a"].Equals(s1)); + test(smap3["a"].Equals(s1)); + + Test.C c1 = new Test.C(s1); + Test.C c2; + Test.C c3 = i.opC(c1, out c2); + test(c2.s.Equals(c1.s)); + test(c3.s.Equals(c1.s)); + + Test.C[] cseq1 = new Test.C[] { c1 }; + Test.C[] cseq2; + Test.C[] cseq3 = i.opCSeq(cseq1, out cseq2); + test(cseq2[0].s.Equals(s1)); + test(cseq3[0].s.Equals(s1)); + + Dictionary<String, Test.C> cmap1 = new Dictionary<String, Test.C>(); + cmap1["a"] = c1; + Dictionary<String, Test.C> cmap2; + Dictionary<String, Test.C> cmap3 = i.opCMap(cmap1, out cmap2); + test(cmap2["a"].s.Equals(s1)); + test(cmap3["a"].s.Equals(s1)); + } + + { + Ice.ObjectPrx obj = communicator.stringToProxy("i4:" + helper.getTestEndpoint()); + Inner.Test.Inner2.IPrx i = Inner.Test.Inner2.IPrxHelper.checkedCast(obj); + + Task.Run(async () => + { + Test.S s1 = new Test.S(0); + Inner.Test.Inner2.I_OpSResult opSResult = await i.opSAsync(s1); + test(s1.Equals(opSResult.returnValue)); + test(s1.Equals(opSResult.s2)); + + Test.S[] sseq1 = new Test.S[] { s1 }; + Inner.Test.Inner2.I_OpSSeqResult opSSeqResult = await i.opSSeqAsync(sseq1); + test(opSSeqResult.returnValue[0].Equals(s1)); + test(opSSeqResult.s2[0].Equals(s1)); + + Dictionary<String, Test.S> smap1 = new Dictionary<String, Test.S>(); + smap1["a"] = s1; + Inner.Test.Inner2.I_OpSMapResult opSMapResult = await i.opSMapAsync(smap1); + test(opSMapResult.returnValue["a"].Equals(s1)); + test(opSMapResult.s2["a"].Equals(s1)); + + Test.C c1 = new Test.C(s1); + Inner.Test.Inner2.I_OpCResult opCResult = await i.opCAsync(c1); + test(c1.s.Equals(opCResult.returnValue.s)); + test(c1.s.Equals(opCResult.c2.s)); + + Test.C[] cseq1 = new Test.C[] { c1 }; + Inner.Test.Inner2.I_OpCSeqResult opCSeqResult = await i.opCSeqAsync(cseq1); + test(opCSeqResult.returnValue[0].s.Equals(s1)); + test(opCSeqResult.c2[0].s.Equals(s1)); + + Dictionary<String, Test.C> cmap1 = new Dictionary<String, Test.C>(); + cmap1["a"] = c1; + Inner.Test.Inner2.I_OpCMapResult opCMapResult = await i.opCMapAsync(cmap1); + test(opCMapResult.returnValue["a"].s.Equals(s1)); + test(opCMapResult.c2["a"].s.Equals(s1)); + }).Wait(); + } + + { Ice.ObjectPrx obj = communicator.stringToProxy("i1:" + helper.getTestEndpoint()); IPrx i = IPrxHelper.checkedCast(obj); i.shutdown(); diff --git a/csharp/test/Ice/scope/Server.cs b/csharp/test/Ice/scope/Server.cs index 1480dd0c028..d814fcbc6ea 100644 --- a/csharp/test/Ice/scope/Server.cs +++ b/csharp/test/Ice/scope/Server.cs @@ -87,7 +87,8 @@ public class Server : Test.TestHelper } public override Dictionary<String, Test.Inner.Inner2.S> - opSMap(Dictionary<String, Test.Inner.Inner2.S> s1, out Dictionary<String, Test.Inner.Inner2.S> s2, Ice.Current current) + opSMap(Dictionary<String, Test.Inner.Inner2.S> s1, out Dictionary<String, Test.Inner.Inner2.S> s2, + Ice.Current current) { s2 = s1; return s1; @@ -108,7 +109,8 @@ public class Server : Test.TestHelper } public override Dictionary<String, Test.Inner.Inner2.C> - opCMap(Dictionary<String, Test.Inner.Inner2.C> c1, out Dictionary<String, Test.Inner.Inner2.C> c2, Ice.Current current) + opCMap(Dictionary<String, Test.Inner.Inner2.C> c1, out Dictionary<String, Test.Inner.Inner2.C> c2, + Ice.Current current) { c2 = c1; return c1; @@ -138,7 +140,8 @@ public class Server : Test.TestHelper } public override Dictionary<String, Test.Inner.Inner2.S> - opSMap(Dictionary<String, Test.Inner.Inner2.S> s1, out Dictionary<String, Test.Inner.Inner2.S> s2, Ice.Current current) + opSMap(Dictionary<String, Test.Inner.Inner2.S> s1, out Dictionary<String, Test.Inner.Inner2.S> s2, + Ice.Current current) { s2 = s1; return s1; @@ -159,7 +162,8 @@ public class Server : Test.TestHelper } public override Dictionary<String, Test.Inner.Inner2.C> - opCMap(Dictionary<String, Test.Inner.Inner2.C> c1, out Dictionary<String, Test.Inner.Inner2.C> c2, Ice.Current current) + opCMap(Dictionary<String, Test.Inner.Inner2.C> c1, out Dictionary<String, Test.Inner.Inner2.C> c2, + Ice.Current current) { c2 = c1; return c1; @@ -172,6 +176,58 @@ public class Server : Test.TestHelper } } + class I4 : Inner.Test.Inner2.IDisp_ + { + public override Test.S + opS(Test.S s1, out Test.S s2, Ice.Current current) + { + s2 = s1; + return s1; + } + + public override Test.S[] + opSSeq(Test.S[] s1, out Test.S[] s2, Ice.Current current) + { + s2 = s1; + return s1; + } + + public override Dictionary<String, Test.S> + opSMap(Dictionary<String, Test.S> s1, out Dictionary<String, Test.S> s2, + Ice.Current current) + { + s2 = s1; + return s1; + } + + public override Test.C + opC(Test.C c1, out Test.C c2, Ice.Current current) + { + c2 = c1; + return c1; + } + + public override Test.C[] + opCSeq(Test.C[] c1, out Test.C[] c2, Ice.Current current) + { + c2 = c1; + return c1; + } + + public override Dictionary<String, Test.C> + opCMap(Dictionary<String, Test.C> c1, out Dictionary<String, Test.C> c2, + Ice.Current current) + { + c2 = c1; + return c1; + } + + public override void shutdown(Ice.Current current) + { + current.adapter.getCommunicator().shutdown(); + } + } + public override void run(string[] args) { Ice.Properties properties = createTestProperties(ref args); @@ -182,6 +238,7 @@ public class Server : Test.TestHelper adapter.add(new I1(), Ice.Util.stringToIdentity("i1")); adapter.add(new I2(), Ice.Util.stringToIdentity("i2")); adapter.add(new I3(), Ice.Util.stringToIdentity("i3")); + adapter.add(new I4(), Ice.Util.stringToIdentity("i4")); adapter.activate(); communicator.waitForShutdown(); } diff --git a/csharp/test/Ice/scope/Test.ice b/csharp/test/Ice/scope/Test.ice index 667d680ccc5..f207bbb9f10 100644 --- a/csharp/test/Ice/scope/Test.ice +++ b/csharp/test/Ice/scope/Test.ice @@ -113,3 +113,29 @@ module Test sequence<I*> ISeq; } } + +module Inner +{ + +module Test +{ + +module Inner2 +{ + interface I + { + Test::S opS(Test::S s1, out Test::S s2); + Test::SSeq opSSeq(Test::SSeq s1, out Test::SSeq s2); + Test::SMap opSMap(Test::SMap s1, out Test::SMap s2); + + Test::C opC(Test::C c1, out Test::C c2); + Test::CSeq opCSeq(Test::CSeq c1, out Test::CSeq c2); + Test::CMap opCMap(Test::CMap c1, out Test::CMap c2); + + void shutdown(); + } +} + +} + +} |