diff options
author | Jose <jose@zeroc.com> | 2018-10-16 22:33:23 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2018-10-16 22:33:23 +0200 |
commit | ce5a065da9b356840bf4e1eb777d94a7ce1fc01b (patch) | |
tree | ccd1f4ae594a078ad4d185cb5021bc35ac3b20f8 | |
parent | Remove extra empty line (diff) | |
download | ice-ce5a065da9b356840bf4e1eb777d94a7ce1fc01b.tar.bz2 ice-ce5a065da9b356840bf4e1eb777d94a7ce1fc01b.tar.xz ice-ce5a065da9b356840bf4e1eb777d94a7ce1fc01b.zip |
Fix IceStorm to correctly load topics from database
Close #222
-rw-r--r-- | CHANGELOG-3.7.md | 3 | ||||
-rw-r--r-- | cpp/msbuild/ice.test.sln | 22 | ||||
-rw-r--r-- | cpp/src/IceStorm/TopicManagerI.cpp | 1 | ||||
-rw-r--r-- | cpp/test/IceStorm/persistent/Client.cpp | 97 | ||||
-rw-r--r-- | cpp/test/IceStorm/persistent/Makefile.mk | 15 | ||||
-rw-r--r-- | cpp/test/IceStorm/persistent/msbuild/client/client.vcxproj | 142 | ||||
-rw-r--r-- | cpp/test/IceStorm/persistent/msbuild/client/client.vcxproj.filters | 23 | ||||
-rw-r--r-- | cpp/test/IceStorm/persistent/msbuild/client/packages.config | 7 | ||||
-rw-r--r-- | cpp/test/IceStorm/persistent/test.py | 70 | ||||
-rw-r--r-- | scripts/IceStormUtil.py | 25 |
10 files changed, 394 insertions, 11 deletions
diff --git a/CHANGELOG-3.7.md b/CHANGELOG-3.7.md index cd39ec55e79..7d7a004c3b9 100644 --- a/CHANGELOG-3.7.md +++ b/CHANGELOG-3.7.md @@ -52,6 +52,9 @@ These are the changes since Ice 3.7.1 included in this pre-release. - Fixed a bug in syslog logger that causes the program name not being correctly displayed with log messages. +- Fixed an IceStorm bug that prevents topics to being correctly restored from + the database when there are multiple topics. + ## Java Changes - Fixed Android IceSSL issue which would cause SSL connections to hang diff --git a/cpp/msbuild/ice.test.sln b/cpp/msbuild/ice.test.sln index 42e04082ba4..5891f804c2a 100644 --- a/cpp/msbuild/ice.test.sln +++ b/cpp/msbuild/ice.test.sln @@ -1195,6 +1195,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "..\test\Ice\scope EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "server", "..\test\Ice\scope\msbuild\server\server.vcxproj", "{0DDD44E0-E425-47BE-8DAA-06CA0E8704D2}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "persistent", "persistent", "{372EA6E7-43FD-49F2-A7CB-FC863BAD9E14}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "..\test\IceStorm\persistent\msbuild\client\client.vcxproj", "{7D48DD81-247D-467E-B94C-D23EC94BDAB0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Cpp11-Debug|Win32 = Cpp11-Debug|Win32 @@ -4143,6 +4147,22 @@ Global {0DDD44E0-E425-47BE-8DAA-06CA0E8704D2}.Release|Win32.Build.0 = Release|Win32 {0DDD44E0-E425-47BE-8DAA-06CA0E8704D2}.Release|x64.ActiveCfg = Release|x64 {0DDD44E0-E425-47BE-8DAA-06CA0E8704D2}.Release|x64.Build.0 = Release|x64 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Cpp11-Debug|Win32.ActiveCfg = Cpp11-Debug|Win32 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Cpp11-Debug|Win32.Build.0 = Cpp11-Debug|Win32 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Cpp11-Debug|x64.ActiveCfg = Cpp11-Debug|x64 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Cpp11-Debug|x64.Build.0 = Cpp11-Debug|x64 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Cpp11-Release|Win32.ActiveCfg = Cpp11-Release|Win32 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Cpp11-Release|Win32.Build.0 = Cpp11-Release|Win32 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Cpp11-Release|x64.ActiveCfg = Cpp11-Release|x64 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Cpp11-Release|x64.Build.0 = Cpp11-Release|x64 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Debug|Win32.ActiveCfg = Debug|Win32 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Debug|Win32.Build.0 = Debug|Win32 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Debug|x64.ActiveCfg = Debug|x64 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Debug|x64.Build.0 = Debug|x64 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Release|Win32.ActiveCfg = Release|Win32 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Release|Win32.Build.0 = Release|Win32 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Release|x64.ActiveCfg = Release|x64 + {7D48DD81-247D-467E-B94C-D23EC94BDAB0}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -4439,6 +4459,8 @@ Global {C167C995-BD18-4BF1-828E-66F7FA0A6BE6} = {2CAF9731-CB18-498C-A3EF-24F3D8A334AC} {A19DC61B-84AE-4983-9B4C-4F4A338178C5} = {C167C995-BD18-4BF1-828E-66F7FA0A6BE6} {0DDD44E0-E425-47BE-8DAA-06CA0E8704D2} = {C167C995-BD18-4BF1-828E-66F7FA0A6BE6} + {372EA6E7-43FD-49F2-A7CB-FC863BAD9E14} = {CEF4EDB3-7782-4B65-9D97-55783C166F4D} + {7D48DD81-247D-467E-B94C-D23EC94BDAB0} = {372EA6E7-43FD-49F2-A7CB-FC863BAD9E14} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {E6FDB68A-64BA-4577-ABCD-40A01257F8AB} diff --git a/cpp/src/IceStorm/TopicManagerI.cpp b/cpp/src/IceStorm/TopicManagerI.cpp index aa47028d370..ee8a3c4482a 100644 --- a/cpp/src/IceStorm/TopicManagerI.cpp +++ b/cpp/src/IceStorm/TopicManagerI.cpp @@ -284,7 +284,6 @@ TopicManagerImpl::TopicManagerImpl(const PersistentInstancePtr& instance) : Ice::Identity topic = k.topic; - bool moreTopics; SubscriberRecordSeq content; while((moreTopics = cursor.get(k, v, MDB_NEXT)) && k.topic == topic) { diff --git a/cpp/test/IceStorm/persistent/Client.cpp b/cpp/test/IceStorm/persistent/Client.cpp new file mode 100644 index 00000000000..010df119047 --- /dev/null +++ b/cpp/test/IceStorm/persistent/Client.cpp @@ -0,0 +1,97 @@ +// ********************************************************************** +// +// 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. +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <IceStorm/IceStorm.h> +#include <TestHelper.h> + +using namespace std; +using namespace Ice; +using namespace IceStorm; +using namespace Test; + +class Client : public Test::TestHelper +{ +public: + + void run(int, char**); +}; + +void +Client::run(int argc, char** argv) +{ + Ice::CommunicatorHolder communicator = initialize(argc, argv); + PropertiesPtr properties = communicator->getProperties(); + string managerProxy = properties->getProperty("IceStormAdmin.TopicManager.Default"); + if(managerProxy.empty()) + { + ostringstream os; + os << argv[0] << ": property `IceStormAdmin.TopicManager.Default' is not set"; + throw invalid_argument(os.str()); + } + + IceStorm::TopicManagerPrx manager = + IceStorm::TopicManagerPrx::checkedCast(communicator->stringToProxy(managerProxy)); + if(!manager) + { + ostringstream os; + os << argv[0] << ": `" << managerProxy << "' is not running"; + throw invalid_argument(os.str()); + } + + if(argc != 2) + { + throw invalid_argument("client create|check"); + } + + string action(argv[1]); + if(action == "create") + { + // + // Create topics + // + cerr << "creating topics and links..." << flush; + TopicPrx linkTo = 0; + for(int i = 0; i < 10; ++i) + { + ostringstream topicName; + topicName << "topic" << i; + TopicPrx topic = manager->create(topicName.str()); + if(linkTo) + { + topic->link(linkTo, i + 1); + } + linkTo = topic; + } + cerr << "ok" << endl; + + // + // Create a subscriber for each topic + // + cerr << "create a susbscriber for each topic... "; + for(int i = 0; i < 10; ++i) + { + ostringstream topicName; + topicName << "topic" << i; + TopicPrx topic = manager->retrieve(topicName.str()); + test(topic); + + ostringstream subscriber; + subscriber << "subscriber" << i << ":default -h 10000"; + topic->subscribeAndGetPublisher(IceStorm::QoS(), communicator->stringToProxy(subscriber.str())); + } + cerr << "ok" << endl; + } + else + { + test(action == "check"); + } +} + +DEFINE_TEST(Client) diff --git a/cpp/test/IceStorm/persistent/Makefile.mk b/cpp/test/IceStorm/persistent/Makefile.mk new file mode 100644 index 00000000000..b6e570b0cf7 --- /dev/null +++ b/cpp/test/IceStorm/persistent/Makefile.mk @@ -0,0 +1,15 @@ +# ********************************************************************** +# +# 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. +# +# ********************************************************************** + +$(test)_programs = client +$(test)_dependencies = IceStorm Ice TestCommon + +$(test)_client_sources = Client.cpp + +tests += $(test) diff --git a/cpp/test/IceStorm/persistent/msbuild/client/client.vcxproj b/cpp/test/IceStorm/persistent/msbuild/client/client.vcxproj new file mode 100644 index 00000000000..fca4acc9d0d --- /dev/null +++ b/cpp/test/IceStorm/persistent/msbuild/client/client.vcxproj @@ -0,0 +1,142 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <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 Project="..\..\..\..\..\msbuild\packages\zeroc.ice.v141.3.7.1\build\native\zeroc.ice.v141.props" Condition="Exists('..\..\..\..\..\msbuild\packages\zeroc.ice.v141.3.7.1\build\native\zeroc.ice.v141.props') and '$(ICE_BIN_DIST)' == 'all'" /> + <Import Project="..\..\..\..\..\msbuild\packages\zeroc.ice.v120.3.7.1\build\native\zeroc.ice.v120.props" Condition="Exists('..\..\..\..\..\msbuild\packages\zeroc.ice.v120.3.7.1\build\native\zeroc.ice.v120.props') and '$(ICE_BIN_DIST)' == 'all'" /> + <Import Project="..\..\..\..\..\msbuild\packages\zeroc.ice.v140.3.7.1\build\native\zeroc.ice.v140.props" Condition="Exists('..\..\..\..\..\msbuild\packages\zeroc.ice.v140.3.7.1\build\native\zeroc.ice.v140.props') and '$(ICE_BIN_DIST)' == 'all'" /> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Cpp11-Debug|Win32"> + <Configuration>Cpp11-Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Cpp11-Debug|x64"> + <Configuration>Cpp11-Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Cpp11-Release|Win32"> + <Configuration>Cpp11-Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Cpp11-Release|x64"> + <Configuration>Cpp11-Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\Client.cpp" /> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{7D48DD81-247D-467E-B94C-D23EC94BDAB0}</ProjectGuid> + <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Cpp11-Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Cpp11-Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Cpp11-Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Cpp11-Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <Import Project="$(MSBuildThisFileDirectory)\..\..\..\..\..\msbuild\ice.test.props" /> + <ImportGroup Label="ExtensionSettings"> + <Import Project="..\..\..\..\..\msbuild\packages\zeroc.ice.v140.3.7.1\build\native\zeroc.ice.v140.targets" Condition="Exists('..\..\..\..\..\msbuild\packages\zeroc.ice.v140.3.7.1\build\native\zeroc.ice.v140.targets') and '$(ICE_BIN_DIST)' == 'all'" /> + <Import Project="..\..\..\..\..\msbuild\packages\zeroc.ice.v120.3.7.1\build\native\zeroc.ice.v120.targets" Condition="Exists('..\..\..\..\..\msbuild\packages\zeroc.ice.v120.3.7.1\build\native\zeroc.ice.v120.targets') and '$(ICE_BIN_DIST)' == 'all'" /> + <Import Project="..\..\..\..\..\msbuild\packages\zeroc.ice.v141.3.7.1\build\native\zeroc.ice.v141.targets" Condition="Exists('..\..\..\..\..\msbuild\packages\zeroc.ice.v141.3.7.1\build\native\zeroc.ice.v141.targets') and '$(ICE_BIN_DIST)' == 'all'" /> + <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')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Cpp11-Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Cpp11-Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Cpp11-Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Cpp11-Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <ItemDefinitionGroup Label="IceBuilder"> + <SliceCompile /> + </ItemDefinitionGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <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.v140.3.7.1\build\native\zeroc.ice.v140.props') and '$(ICE_BIN_DIST)' == 'all'" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\msbuild\packages\zeroc.ice.v140.3.7.1\build\native\zeroc.ice.v140.props'))" /> + <Error Condition="!Exists('..\..\..\..\..\msbuild\packages\zeroc.ice.v140.3.7.1\build\native\zeroc.ice.v140.targets') and '$(ICE_BIN_DIST)' == 'all'" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\msbuild\packages\zeroc.ice.v140.3.7.1\build\native\zeroc.ice.v140.targets'))" /> + <Error Condition="!Exists('..\..\..\..\..\msbuild\packages\zeroc.ice.v120.3.7.1\build\native\zeroc.ice.v120.props') and '$(ICE_BIN_DIST)' == 'all'" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\msbuild\packages\zeroc.ice.v120.3.7.1\build\native\zeroc.ice.v120.props'))" /> + <Error Condition="!Exists('..\..\..\..\..\msbuild\packages\zeroc.ice.v120.3.7.1\build\native\zeroc.ice.v120.targets') and '$(ICE_BIN_DIST)' == 'all'" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\msbuild\packages\zeroc.ice.v120.3.7.1\build\native\zeroc.ice.v120.targets'))" /> + <Error Condition="!Exists('..\..\..\..\..\msbuild\packages\zeroc.ice.v141.3.7.1\build\native\zeroc.ice.v141.props') and '$(ICE_BIN_DIST)' == 'all'" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\msbuild\packages\zeroc.ice.v141.3.7.1\build\native\zeroc.ice.v141.props'))" /> + <Error Condition="!Exists('..\..\..\..\..\msbuild\packages\zeroc.ice.v141.3.7.1\build\native\zeroc.ice.v141.targets') and '$(ICE_BIN_DIST)' == 'all'" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\msbuild\packages\zeroc.ice.v141.3.7.1\build\native\zeroc.ice.v141.targets'))" /> + <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> +</Project>
\ No newline at end of file diff --git a/cpp/test/IceStorm/persistent/msbuild/client/client.vcxproj.filters b/cpp/test/IceStorm/persistent/msbuild/client/client.vcxproj.filters new file mode 100644 index 00000000000..6a285e99a08 --- /dev/null +++ b/cpp/test/IceStorm/persistent/msbuild/client/client.vcxproj.filters @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{908d3c81-3756-42f5-ba9e-23baeb3fdde6}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{f54ac765-2ba1-40bc-92c2-5f8af6c4a3c7}</UniqueIdentifier> + </Filter> + <Filter Include="Slice Files"> + <UniqueIdentifier>{e0d94eba-4a39-495d-88b1-5199d4c19bad}</UniqueIdentifier> + <Extensions>ice</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\Client.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/cpp/test/IceStorm/persistent/msbuild/client/packages.config b/cpp/test/IceStorm/persistent/msbuild/client/packages.config new file mode 100644 index 00000000000..d5207a7afd8 --- /dev/null +++ b/cpp/test/IceStorm/persistent/msbuild/client/packages.config @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="zeroc.ice.v120" version="3.7.1" targetFramework="native" /> + <package id="zeroc.ice.v140" version="3.7.1" targetFramework="native" /> + <package id="zeroc.ice.v141" version="3.7.1" targetFramework="native" /> + <package id="zeroc.icebuilder.msbuild" version="5.0.4" targetFramework="native" /> +</packages>
\ No newline at end of file diff --git a/cpp/test/IceStorm/persistent/test.py b/cpp/test/IceStorm/persistent/test.py new file mode 100644 index 00000000000..291f457cc40 --- /dev/null +++ b/cpp/test/IceStorm/persistent/test.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +# ********************************************************************** +# +# 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. +# +# ********************************************************************** + +icestorm1 = IceStorm(createDb=True, cleanDb=False) +icestorm2 = IceStorm(createDb=False, cleanDb=True) + + +def test(value): + if not value: + raise RuntimeError("test failed") + + +class IceStormPersistentTestCase(TestCase): + + def __init__(self, name, icestorm, *args, **kargs): + TestCase.__init__(self, name, *args, **kargs) + self.icestorm = icestorm + + def init(self, mapping, testsuite): + TestCase.init(self, mapping, testsuite) + self.servers = [self.icestorm] + + def runWithDriver(self, current): + current.driver.runClientServerTestCase(current) + + def teardownClientSide(self, current, success): + admin = IceStormAdmin(instance=self.icestorm, quiet=True, + args=["-e", "topics {}".format(self.icestorm.getInstanceName())]) + admin.run(current, exitstatus=0) + # + # Ensure all topics have been restored from the storage + # + topics = admin.getOutput(current).split() + test(len(topics) == 10) + for i in range(0, 10): + topic = topics[i] + admin = IceStormAdmin(instance=self.icestorm, quiet=True, + args=["-e", + "current {0};subscribers {1}".format(self.icestorm.getInstanceName(), topic)]) + admin.run(current, exitstatus=0) + subscribers = admin.getOutput(current).split()[2:] + test("subscriber{0}".format(i) in subscribers) + if i > 0: + test("IceStorm/topic.topic{0}".format(i - 1) in subscribers) + + self.icestorm.shutdown(current) + +class PersistentClient(IceStormProcess, Client): + + processType = "client" + + def __init__(self, instanceName=None, instance=None, *args, **kargs): + Client.__init__(self, *args, **kargs) + IceStormProcess.__init__(self, instanceName, instance) + + getParentProps = Client.getProps # Used by IceStormProcess to get the client properties + +TestSuite(__file__, [ + IceStormPersistentTestCase("persistent create", icestorm1, + client=ClientTestCase(client=PersistentClient(instance=icestorm1, args=["create"]))), + IceStormPersistentTestCase("persistent check", icestorm2, + client=ClientTestCase(client=PersistentClient(instance=icestorm2, args=["check"]))), +], multihost=False) diff --git a/scripts/IceStormUtil.py b/scripts/IceStormUtil.py index 42ff472ad24..8f61c6f5140 100644 --- a/scripts/IceStormUtil.py +++ b/scripts/IceStormUtil.py @@ -14,29 +14,34 @@ from IceBoxUtil import * class IceStorm(ProcessFromBinDir, Server): - def __init__(self, instanceName="IceStorm", replica=0, nreplicas=0, transient=False, portnum=0, *args, **kargs): + def __init__(self, instanceName="IceStorm", replica=0, nreplicas=0, transient=False, portnum=0, + createDb=True, cleanDb=True, *args, **kargs): Server.__init__(self, exe="icebox", ready="IceStorm", mapping=Mapping.getByName("cpp"), *args, **kargs) self.portnum = portnum self.replica = replica self.nreplicas = nreplicas self.transient = transient self.instanceName = instanceName + self.createDb = createDb + self.cleanDb = cleanDb self.desc = self.instanceName if self.nreplicas == 0 else "{0} replica #{1}".format(self.instanceName, self.replica) def setup(self, current): # Create the database directory - self.dbdir = os.path.join(current.testsuite.getPath(), "{0}-{1}.db".format(self.instanceName, self.replica)) - if os.path.exists(self.dbdir): - shutil.rmtree(self.dbdir) - os.mkdir(self.dbdir) + if self.createDb: + self.dbdir = os.path.join(current.testsuite.getPath(), "{0}-{1}.db".format(self.instanceName, self.replica)) + if os.path.exists(self.dbdir): + shutil.rmtree(self.dbdir) + os.mkdir(self.dbdir) def teardown(self, current, success): - # Remove the database directory tree - try: - shutil.rmtree(self.dbdir) - except: - pass + if self.cleanDb: + # Remove the database directory tree + try: + shutil.rmtree(self.dbdir) + except: + pass def getProps(self, current): props = Server.getProps(self, current) |