diff options
author | Jose <jose@zeroc.com> | 2015-01-28 10:35:55 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2015-01-28 10:35:55 +0100 |
commit | 093b3ec0741c50462ffd2cd5afd9d07dbf6e42be (patch) | |
tree | c22963fd0fb80c832d7f6ef70a323d57765f65d5 /cpp | |
parent | Added test for ICE-5833, generated #include in headers files (diff) | |
download | ice-093b3ec0741c50462ffd2cd5afd9d07dbf6e42be.tar.bz2 ice-093b3ec0741c50462ffd2cd5afd9d07dbf6e42be.tar.xz ice-093b3ec0741c50462ffd2cd5afd9d07dbf6e42be.zip |
Fixed (ICE-6190) - Improve WinRT ssl/wss testing
Diffstat (limited to 'cpp')
45 files changed, 1440 insertions, 762 deletions
diff --git a/cpp/config/Make.rules.mak b/cpp/config/Make.rules.mak index 8de772697d2..88f4640802a 100755 --- a/cpp/config/Make.rules.mak +++ b/cpp/config/Make.rules.mak @@ -295,6 +295,7 @@ depend:: $(SLICE_SRCS:.ice=.d) !if "$(SLICE_OBJS)" != "" SLICE_SRCS = $(SLICE_OBJS:.obj=.cpp) +SLICE_SRCS = $(SLICE_SRCS:winrt\=) SLICE_SRCS = $(SLICE_SRCS:.\=) all:: $(SLICE_SRCS) !endif @@ -318,6 +319,10 @@ depend:: $(SRCS) $(OBJS_DEPEND) @if not exist "$(ARCH)\$(CONFIG)" mkdir $(ARCH)\$(CONFIG) $(CXX) /c /Fo$(ARCH)\$(CONFIG)\ $(CPPFLAGS) $(CXXFLAGS) $< +.cpp{$(OBJDIR)\}.obj:: + @if not exist "$(OBJDIR)" mkdir $(OBJDIR) + $(CXX) /c /Fo$(OBJDIR)\ $(CPPFLAGS) $(CXXFLAGS) $< + {$(slicedir)\Glacier2\}.ice{Glacier2\}.d: @echo Generating dependencies for $< @"$(SLICE2CPP)" $(SLICE2CPPFLAGS) --depend $< | cscript /NoLogo $(top_srcdir)\..\config\makedepend-slice.vbs $(*F).ice "..\" @@ -408,8 +413,13 @@ clean:: !endif +!if "$(OBJDIR)" == "" clean:: -del /q *.obj *.bak *.ilk *.exp *.pdb *.tds *.idb +!else +clean:: + -del /q $(OBJDIR)\*.obj $(OBJDIR)\*.bak $(OBJDIR)\*.ilk $(OBJDIR)\*.exp $(OBJDIR)\*.pdb $(OBJDIR)\*.tds $(OBJDIR)\*.idb +!endif install:: diff --git a/cpp/include/IceGrid/.headers b/cpp/include/IceGrid/.headers index a215ee2e946..a10f5bdac20 100644 --- a/cpp/include/IceGrid/.headers +++ b/cpp/include/IceGrid/.headers @@ -8,6 +8,7 @@ SDK_HEADERS = \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\IceGrid.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Locator.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Observer.h \ + $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\PluginFacade.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Query.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Registry.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ReplicaGroupFilter.h \ diff --git a/cpp/test/Ice/acm/Makefile.mak b/cpp/test/Ice/acm/Makefile.mak index 1c66f088035..ea59c0cb7ee 100644 --- a/cpp/test/Ice/acm/Makefile.mak +++ b/cpp/test/Ice/acm/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_acm_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -22,15 +24,15 @@ SERVER = $(NAME_PREFIX)server TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Server.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj OBJS = $(COBJS) \ $(SOBJS) diff --git a/cpp/test/Ice/adapterDeactivation/AllTests.cpp b/cpp/test/Ice/adapterDeactivation/AllTests.cpp index 39b35947cb7..3280a561983 100644 --- a/cpp/test/Ice/adapterDeactivation/AllTests.cpp +++ b/cpp/test/Ice/adapterDeactivation/AllTests.cpp @@ -30,12 +30,14 @@ allTests(const CommunicatorPtr& communicator) cout << "ok" << endl; { + string host = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.IPv6", 0) == 0 ? + "127.0.0.1" : "0:0:0:0:0:0:0:1"; cout << "creating/destroying/recreating object adapter... " << flush; ObjectAdapterPtr adapter = - communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default"); + communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -h " + host); try { - communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default"); + communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -h " + host); test(false); } catch(const AlreadyRegisteredException&) @@ -46,7 +48,7 @@ allTests(const CommunicatorPtr& communicator) // // Use a different port than the first adapter to avoid an "address already in use" error. // - adapter = communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default"); + adapter = communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -h " + host); adapter->destroy(); cout << "ok" << endl; } diff --git a/cpp/test/Ice/adapterDeactivation/Makefile.mak b/cpp/test/Ice/adapterDeactivation/Makefile.mak index a152b9c7b61..df7dae45ad5 100644 --- a/cpp/test/Ice/adapterDeactivation/Makefile.mak +++ b/cpp/test/Ice/adapterDeactivation/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_adapterDeactivation_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -23,22 +25,22 @@ COLLOCATED = $(NAME_PREFIX)collocated TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) $(COLLOCATED)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\ServantLocatorI.obj \ - .\Server.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\ServantLocatorI.obj \ + $(OBJDIR)\Server.obj COLOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\ServantLocatorI.obj \ - .\Collocated.obj \ - .\AllTests.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\ServantLocatorI.obj \ + $(OBJDIR)\Collocated.obj \ + $(OBJDIR)\AllTests.obj OBJS = $(COBJS) \ $(SOBJS) \ diff --git a/cpp/test/Ice/admin/AllTests.cpp b/cpp/test/Ice/admin/AllTests.cpp index e595ab46003..09f0fc2909c 100644 --- a/cpp/test/Ice/admin/AllTests.cpp +++ b/cpp/test/Ice/admin/AllTests.cpp @@ -262,13 +262,15 @@ allTests(const Ice::CommunicatorPtr& communicator) RemoteCommunicatorFactoryPrx factory = RemoteCommunicatorFactoryPrx::uncheckedCast(communicator->stringToProxy(ref)); + string defaultHost = communicator->getProperties()->getProperty("Ice.Default.Host"); + cout << "testing process facet... " << flush; { // // Test: Verify that Process::shutdown() operation shuts down the communicator. // Ice::PropertyDict props; - props["Ice.Admin.Endpoints"] = "tcp -h 127.0.0.1"; + props["Ice.Admin.Endpoints"] = "tcp -h " + defaultHost; props["Ice.Admin.InstanceName"] = "Test"; RemoteCommunicatorPrx com = factory->createCommunicator(props); Ice::ObjectPrx obj = com->getAdmin(); @@ -282,7 +284,7 @@ allTests(const Ice::CommunicatorPtr& communicator) cout << "testing properties facet... " << flush; { Ice::PropertyDict props; - props["Ice.Admin.Endpoints"] = "tcp -h 127.0.0.1"; + props["Ice.Admin.Endpoints"] = "tcp -h " + defaultHost; props["Ice.Admin.InstanceName"] = "Test"; props["Prop1"] = "1"; props["Prop2"] = "2"; @@ -302,7 +304,7 @@ allTests(const Ice::CommunicatorPtr& communicator) // Ice::PropertyDict pd = pa->getPropertiesForPrefix(""); test(pd.size() == 5); - test(pd["Ice.Admin.Endpoints"] == "tcp -h 127.0.0.1"); + test(pd["Ice.Admin.Endpoints"] == "tcp -h " + defaultHost); test(pd["Ice.Admin.InstanceName"] == "Test"); test(pd["Prop1"] == "1"); test(pd["Prop2"] == "2"); @@ -340,10 +342,15 @@ allTests(const Ice::CommunicatorPtr& communicator) } cout << "ok" << endl; +#ifndef ICE_OS_WINRT + // + // This doesn't work well with WinRT because connection to localhost are + // restricted to the same process. + // cout << "testing logger facet... " << flush; { Ice::PropertyDict props; - props["Ice.Admin.Endpoints"] = "tcp -h 127.0.0.1"; + props["Ice.Admin.Endpoints"] = "tcp -h " + defaultHost; props["Ice.Admin.InstanceName"] = "Test"; props["NullLogger"] = "1"; RemoteCommunicatorPrx com = factory->createCommunicator(props); @@ -510,6 +517,7 @@ allTests(const Ice::CommunicatorPtr& communicator) com->destroy(); } cout << "ok" << endl; +#endif cout << "testing custom facet... " << flush; { @@ -517,7 +525,7 @@ allTests(const Ice::CommunicatorPtr& communicator) // Test: Verify that the custom facet is present. // Ice::PropertyDict props; - props["Ice.Admin.Endpoints"] = "tcp -h 127.0.0.1"; + props["Ice.Admin.Endpoints"] = "tcp -h " + defaultHost; props["Ice.Admin.InstanceName"] = "Test"; RemoteCommunicatorPrx com = factory->createCommunicator(props); Ice::ObjectPrx obj = com->getAdmin(); @@ -534,7 +542,7 @@ allTests(const Ice::CommunicatorPtr& communicator) // meaning no other facet is available. // Ice::PropertyDict props; - props["Ice.Admin.Endpoints"] = "tcp -h 127.0.0.1"; + props["Ice.Admin.Endpoints"] = "tcp -h " + defaultHost; props["Ice.Admin.InstanceName"] = "Test"; props["Ice.Admin.Facets"] = "Properties"; RemoteCommunicatorPrx com = factory->createCommunicator(props); @@ -551,7 +559,7 @@ allTests(const Ice::CommunicatorPtr& communicator) // meaning no other facet is available. // Ice::PropertyDict props; - props["Ice.Admin.Endpoints"] = "tcp -h 127.0.0.1"; + props["Ice.Admin.Endpoints"] = "tcp -h " + defaultHost; props["Ice.Admin.InstanceName"] = "Test"; props["Ice.Admin.Facets"] = "Process"; RemoteCommunicatorPrx com = factory->createCommunicator(props); @@ -568,7 +576,7 @@ allTests(const Ice::CommunicatorPtr& communicator) // meaning no other facet is available. // Ice::PropertyDict props; - props["Ice.Admin.Endpoints"] = "tcp -h 127.0.0.1"; + props["Ice.Admin.Endpoints"] = "tcp -h " + defaultHost; props["Ice.Admin.InstanceName"] = "Test"; props["Ice.Admin.Facets"] = "TestFacet"; RemoteCommunicatorPrx com = factory->createCommunicator(props); @@ -585,7 +593,7 @@ allTests(const Ice::CommunicatorPtr& communicator) // facet names. // Ice::PropertyDict props; - props["Ice.Admin.Endpoints"] = "tcp -h 127.0.0.1"; + props["Ice.Admin.Endpoints"] = "tcp -h " + defaultHost; props["Ice.Admin.InstanceName"] = "Test"; props["Ice.Admin.Facets"] = "Properties TestFacet"; RemoteCommunicatorPrx com = factory->createCommunicator(props); @@ -604,7 +612,7 @@ allTests(const Ice::CommunicatorPtr& communicator) // facet names. // Ice::PropertyDict props; - props["Ice.Admin.Endpoints"] = "tcp -h 127.0.0.1"; + props["Ice.Admin.Endpoints"] = "tcp -h " + defaultHost; props["Ice.Admin.InstanceName"] = "Test"; props["Ice.Admin.Facets"] = "TestFacet, Process"; RemoteCommunicatorPrx com = factory->createCommunicator(props); diff --git a/cpp/test/Ice/admin/Makefile.mak b/cpp/test/Ice/admin/Makefile.mak index d026250ddf7..bd66034e73e 100644 --- a/cpp/test/Ice/admin/Makefile.mak +++ b/cpp/test/Ice/admin/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_admin_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -22,15 +24,15 @@ SERVER = $(NAME_PREFIX)server TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj -SOBJS = .\Test.obj \ - .\TestI.obj \ - .\Server.obj +SOBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj OBJS = $(COBJS) \ $(SOBJS) diff --git a/cpp/test/Ice/ami/Makefile.mak b/cpp/test/Ice/ami/Makefile.mak index 7d2bb40e526..73a3afa68cc 100644 --- a/cpp/test/Ice/ami/Makefile.mak +++ b/cpp/test/Ice/ami/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_ami_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -23,20 +25,20 @@ COLLOCATED = $(NAME_PREFIX)collocated TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) $(COLLOCATED)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Server.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj COLOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Collocated.obj \ - .\AllTests.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Collocated.obj \ + $(OBJDIR)\AllTests.obj OBJS = $(COBJS) \ $(SOBJS) \ diff --git a/cpp/test/Ice/binding/Makefile.mak b/cpp/test/Ice/binding/Makefile.mak index b83c459b727..5fba0077d30 100644 --- a/cpp/test/Ice/binding/Makefile.mak +++ b/cpp/test/Ice/binding/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_binding_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -22,15 +24,15 @@ SERVER = $(NAME_PREFIX)server TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Server.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj OBJS = $(COBJS) \ $(SOBJS) diff --git a/cpp/test/Ice/dispatcher/Makefile.mak b/cpp/test/Ice/dispatcher/Makefile.mak index 0d473a135b1..8bbff9e8a24 100644 --- a/cpp/test/Ice/dispatcher/Makefile.mak +++ b/cpp/test/Ice/dispatcher/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_dispatcher_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -23,23 +25,23 @@ COLLOCATED = $(NAME_PREFIX)collocated TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) $(COLLOCATED)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\Client.obj \ - .\AllTests.obj \ - .\Dispatcher.obj + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj \ + $(OBJDIR)\Dispatcher.obj SOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Server.obj \ - .\Dispatcher.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj \ + $(OBJDIR)\Dispatcher.obj COLOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Collocated.obj \ - .\Dispatcher.obj \ - .\AllTests.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Collocated.obj \ + $(OBJDIR)\Dispatcher.obj \ + $(OBJDIR)\AllTests.obj OBJS = $(COBJS) \ $(SOBJS) \ diff --git a/cpp/test/Ice/echo/Makefile.mak b/cpp/test/Ice/echo/Makefile.mak index 6ecb6710164..3eb52cf3e9b 100644 --- a/cpp/test/Ice/echo/Makefile.mak +++ b/cpp/test/Ice/echo/Makefile.mak @@ -12,20 +12,22 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_invoke_ EXT = .dll +OBJDIR = winrt !endif SERVER = $(NAME_PREFIX)server TARGETS = $(SERVER)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj OBJS = $(SLICE_OBJS) \ - .\BlobjectI.obj \ - .\Server.obj + $(OBJDIR)\BlobjectI.obj \ + $(OBJDIR)\Server.obj !include $(top_srcdir)/config/Make.rules.mak diff --git a/cpp/test/Ice/enums/Makefile.mak b/cpp/test/Ice/enums/Makefile.mak index 0d83447b492..9d30c211669 100644 --- a/cpp/test/Ice/enums/Makefile.mak +++ b/cpp/test/Ice/enums/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_enums_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -22,15 +24,15 @@ SERVER = $(NAME_PREFIX)server TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Server.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj OBJS = $(COBJS) \ $(SOBJS) diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp index 51cb490216e..f82840a5b6d 100644 --- a/cpp/test/Ice/exceptions/AllTests.cpp +++ b/cpp/test/Ice/exceptions/AllTests.cpp @@ -498,7 +498,9 @@ allTests(const Ice::CommunicatorPtr& communicator) // Expected } - communicator->getProperties()->setProperty("TestAdapter0.Endpoints", "default"); + string host = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.IPv6", 0) == 0 ? + "127.0.0.1" : "0:0:0:0:0:0:0:1"; + communicator->getProperties()->setProperty("TestAdapter0.Endpoints", "default -h " + host); first = communicator->createObjectAdapter("TestAdapter0"); try { @@ -538,7 +540,9 @@ allTests(const Ice::CommunicatorPtr& communicator) cout << "testing servant registration exceptions... " << flush; { - communicator->getProperties()->setProperty("TestAdapter1.Endpoints", "default"); + string host = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.IPv6", 0) == 0 ? + "127.0.0.1" : "0:0:0:0:0:0:0:1"; + communicator->getProperties()->setProperty("TestAdapter1.Endpoints", "default -h " + host); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter1"); Ice::ObjectPtr obj = new EmptyI; adapter->add(obj, communicator->stringToIdentity("x")); @@ -605,7 +609,9 @@ allTests(const Ice::CommunicatorPtr& communicator) cout << "testing servant locator registrations exceptions... " << flush; { - communicator->getProperties()->setProperty("TestAdapter2.Endpoints", "default"); + string host = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.IPv6", 0) == 0 ? + "127.0.0.1" : "0:0:0:0:0:0:0:1"; + communicator->getProperties()->setProperty("TestAdapter2.Endpoints", "default -h " + host); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter2"); Ice::ServantLocatorPtr loc = new ServantLocatorI; adapter->addServantLocator(loc, "x"); diff --git a/cpp/test/Ice/exceptions/Makefile.mak b/cpp/test/Ice/exceptions/Makefile.mak index 9fdda5c68e5..55f21a606e1 100644 --- a/cpp/test/Ice/exceptions/Makefile.mak +++ b/cpp/test/Ice/exceptions/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_exceptions_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -24,29 +26,29 @@ COLLOCATED = $(NAME_PREFIX)collocated TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) $(SERVERAMD)$(EXT) $(COLLOCATED)$(EXT) -SLICE_OBJS = .\Test.obj .\TestAMD.obj -COMMON_OBJS = .\ExceptionsI.obj +SLICE_OBJS = $(OBJDIR)\Test.obj $(OBJDIR)\TestAMD.obj +COMMON_OBJS = $(OBJDIR)\ExceptionsI.obj COBJS = $(COMMON_OBJS) \ - .\Test.obj \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\Test.obj \ + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(COMMON_OBJS) \ - .\Test.obj \ - .\TestI.obj \ - .\Server.obj + $(OBJDIR)\Test.obj \ + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj SAMDOBJS = $(COMMON_OBJS) \ - .\TestAMD.obj \ - .\TestAMDI.obj \ - .\ServerAMD.obj + $(OBJDIR)\TestAMD.obj \ + $(OBJDIR)\TestAMDI.obj \ + $(OBJDIR)\ServerAMD.obj COLOBJS = $(COMMON_OBJS) \ - .\Test.obj \ - .\TestI.obj \ - .\Collocated.obj \ - .\AllTests.obj + $(OBJDIR)\Test.obj \ + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Collocated.obj \ + $(OBJDIR)\AllTests.obj OBJS = $(COBJS) \ $(SOBJS) \ diff --git a/cpp/test/Ice/facets/AllTests.cpp b/cpp/test/Ice/facets/AllTests.cpp index d261f7e48fe..f955dd2198e 100644 --- a/cpp/test/Ice/facets/AllTests.cpp +++ b/cpp/test/Ice/facets/AllTests.cpp @@ -44,7 +44,9 @@ allTests(const Ice::CommunicatorPtr& communicator) cout << "ok" << endl; cout << "testing facet registration exceptions... " << flush; - communicator->getProperties()->setProperty("FacetExceptionTestAdapter.Endpoints", "default"); + string host = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.IPv6", 0) == 0 ? + "127.0.0.1" : "0:0:0:0:0:0:0:1"; + communicator->getProperties()->setProperty("FacetExceptionTestAdapter.Endpoints", "default -h " + host); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("FacetExceptionTestAdapter"); Ice::ObjectPtr obj = new EmptyI; adapter->add(obj, communicator->stringToIdentity("d")); diff --git a/cpp/test/Ice/facets/Makefile.mak b/cpp/test/Ice/facets/Makefile.mak index 0ca6739fa8c..fe89af3f0c4 100644 --- a/cpp/test/Ice/facets/Makefile.mak +++ b/cpp/test/Ice/facets/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_facets_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -23,20 +25,20 @@ COLLOCATED = $(NAME_PREFIX)collocated TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) $(COLLOCATED)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Server.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj COLOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Collocated.obj \ - .\AllTests.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Collocated.obj \ + $(OBJDIR)\AllTests.obj OBJS = $(COBJS) \ $(SOBJS) \ diff --git a/cpp/test/Ice/hash/Makefile.mak b/cpp/test/Ice/hash/Makefile.mak index 7473976aeec..db5d7465c5f 100644 --- a/cpp/test/Ice/hash/Makefile.mak +++ b/cpp/test/Ice/hash/Makefile.mak @@ -12,19 +12,21 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_hash_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client TARGETS = $(CLIENT)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj OBJS = $(SLICE_OBJS) \ - .\Client.obj + $(OBJDIR)\Client.obj !include $(top_srcdir)/config/Make.rules.mak diff --git a/cpp/test/Ice/hold/Makefile.mak b/cpp/test/Ice/hold/Makefile.mak index 7221e0b1191..98b0dd2d9ba 100644 --- a/cpp/test/Ice/hold/Makefile.mak +++ b/cpp/test/Ice/hold/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_hold_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -22,15 +24,15 @@ SERVER = $(NAME_PREFIX)server TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Server.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj OBJS = $(COBJS) \ $(SOBJS) diff --git a/cpp/test/Ice/info/AllTests.cpp b/cpp/test/Ice/info/AllTests.cpp index bca2716cfcc..dd0acba9168 100644 --- a/cpp/test/Ice/info/AllTests.cpp +++ b/cpp/test/Ice/info/AllTests.cpp @@ -73,7 +73,7 @@ allTests(const Ice::CommunicatorPtr& communicator) string defaultHost = communicator->getProperties()->getProperty("Ice.Default.Host"); cout << "test object adapter endpoint information... " << flush; { - communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -t 15000:udp"); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -h 127.0.0.1 -t 15000:udp -h 127.0.0.1"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::EndpointSeq endpoints = adapter->getEndpoints(); @@ -85,13 +85,13 @@ allTests(const Ice::CommunicatorPtr& communicator) test(ipEndpoint); test(ipEndpoint->type() == Ice::TCPEndpointType || ipEndpoint->type() == IceSSL::EndpointType || ipEndpoint->type() == Ice::WSEndpointType || ipEndpoint->type() == Ice::WSSEndpointType); - test(ipEndpoint->host == defaultHost); + test(ipEndpoint->host == "127.0.0.1"); test(ipEndpoint->port > 0); test(ipEndpoint->timeout == 15000); Ice::UDPEndpointInfoPtr udpEndpoint = Ice::UDPEndpointInfoPtr::dynamicCast(endpoints[1]->getInfo()); test(udpEndpoint); - test(udpEndpoint->host == defaultHost); + test(udpEndpoint->host == "127.0.0.1"); test(udpEndpoint->datagram()); test(udpEndpoint->port > 0); diff --git a/cpp/test/Ice/info/Makefile.mak b/cpp/test/Ice/info/Makefile.mak index f011a098e7f..bbef2f047d1 100644 --- a/cpp/test/Ice/info/Makefile.mak +++ b/cpp/test/Ice/info/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_info_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -22,16 +24,16 @@ SERVER = $(NAME_PREFIX)server TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Server.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj OBJS = $(COBJS) \ $(SOBJS) diff --git a/cpp/test/Ice/inheritance/Makefile.mak b/cpp/test/Ice/inheritance/Makefile.mak index 44cbb814abb..057669a74a6 100644 --- a/cpp/test/Ice/inheritance/Makefile.mak +++ b/cpp/test/Ice/inheritance/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_inheritance_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -23,20 +25,20 @@ COLLOCATED = $(NAME_PREFIX)collocated TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) $(COLLOCATED)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Server.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj COLOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Collocated.obj \ - .\AllTests.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Collocated.obj \ + $(OBJDIR)\AllTests.obj OBJS = $(COBJS) \ $(SOBJS) \ diff --git a/cpp/test/Ice/invoke/Makefile.mak b/cpp/test/Ice/invoke/Makefile.mak index 4ad9ecb1564..6cc9a727f99 100644 --- a/cpp/test/Ice/invoke/Makefile.mak +++ b/cpp/test/Ice/invoke/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_invoke_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -22,15 +24,15 @@ SERVER = $(NAME_PREFIX)server TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\BlobjectI.obj \ - .\Server.obj + $(OBJDIR)\BlobjectI.obj \ + $(OBJDIR)\Server.obj OBJS = $(COBJS) \ $(SOBJS) diff --git a/cpp/test/Ice/location/AllTests.cpp b/cpp/test/Ice/location/AllTests.cpp index 2d34b314217..b10dcd45238 100644 --- a/cpp/test/Ice/location/AllTests.cpp +++ b/cpp/test/Ice/location/AllTests.cpp @@ -622,26 +622,30 @@ allTests(const Ice::CommunicatorPtr& communicator, const string& ref) } cout << "ok" << endl; - cout << "testing indirect proxies to collocated objects... " << flush; - // - // Set up test for calling a collocated object through an indirect, adapterless reference. - // - Ice::PropertiesPtr properties = communicator->getProperties(); - properties->setProperty("Ice.PrintAdapterReady", "0"); - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("Hello", "default"); - adapter->setLocator(locator); - - Ice::Identity id; - id.name = IceUtil::generateUUID(); - registry->addObject(adapter->add(new HelloI, id)); - adapter->activate(); - - HelloPrx helloPrx = HelloPrx::checkedCast(communicator->stringToProxy(communicator->identityToString(id))); - test(!helloPrx->ice_getConnection()); - - adapter->deactivate(); - cout << "ok" << endl; - + string host = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.IPv6", 0) == 0 ? + "127.0.0.1" : "0:0:0:0:0:0:0:1"; + if(communicator->getProperties()->getProperty("Ice.Default.Host") == host) + { + cout << "testing indirect proxies to collocated objects... " << flush; + // + // Set up test for calling a collocated object through an indirect, adapterless reference. + // + Ice::PropertiesPtr properties = communicator->getProperties(); + properties->setProperty("Ice.PrintAdapterReady", "0"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("Hello", "default"); + adapter->setLocator(locator); + + Ice::Identity id; + id.name = IceUtil::generateUUID(); + registry->addObject(adapter->add(new HelloI, id)); + adapter->activate(); + + HelloPrx helloPrx = HelloPrx::checkedCast(communicator->stringToProxy(communicator->identityToString(id))); + test(!helloPrx->ice_getConnection()); + + adapter->deactivate(); + cout << "ok" << endl; + } cout << "shutdown server manager... " << flush; manager->shutdown(); cout << "ok" << endl; diff --git a/cpp/test/Ice/location/Makefile.mak b/cpp/test/Ice/location/Makefile.mak index 1a59f0392af..aa5d42f8825 100644 --- a/cpp/test/Ice/location/Makefile.mak +++ b/cpp/test/Ice/location/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_location_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -22,16 +24,16 @@ SERVER = $(NAME_PREFIX)server TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\ServerLocator.obj \ - .\Server.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\ServerLocator.obj \ + $(OBJDIR)\Server.obj OBJS = $(COBJS) \ $(SOBJS) diff --git a/cpp/test/Ice/metrics/Makefile.mak b/cpp/test/Ice/metrics/Makefile.mak index 1b2329a453f..55a5444faac 100644 --- a/cpp/test/Ice/metrics/Makefile.mak +++ b/cpp/test/Ice/metrics/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_metrics_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -24,24 +26,24 @@ COLLOCATED = $(NAME_PREFIX)collocated TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) $(SERVERAMD)$(EXT) $(COLLOCATED)$(EXT) -SLICE_OBJS = .\Test.obj .\TestAMD.obj +SLICE_OBJS = $(OBJDIR)\Test.obj $(OBJDIR)\TestAMD.obj -COBJS = .\Test.obj \ - .\Client.obj \ - .\AllTests.obj +COBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj -SOBJS = .\Test.obj \ - .\TestI.obj \ - .\Server.obj +SOBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj -SAMDOBJS = .\TestAMD.obj \ - .\TestAMDI.obj \ - .\ServerAMD.obj +SAMDOBJS = $(OBJDIR)\TestAMD.obj \ + $(OBJDIR)\TestAMDI.obj \ + $(OBJDIR)\ServerAMD.obj -COLOBJS = .\Test.obj \ - .\TestI.obj \ - .\AllTests.obj \ - .\Collocated.obj +COLOBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\AllTests.obj \ + $(OBJDIR)\Collocated.obj OBJS = $(COBJS) \ $(SOBJS) \ diff --git a/cpp/test/Ice/networkProxy/Makefile.mak b/cpp/test/Ice/networkProxy/Makefile.mak index 433a25a800d..84d5fe0d360 100644 --- a/cpp/test/Ice/networkProxy/Makefile.mak +++ b/cpp/test/Ice/networkProxy/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_networkProxy_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -22,14 +24,14 @@ SERVER = $(NAME_PREFIX)server TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\Server.obj + $(OBJDIR)\Server.obj OBJS = $(COBJS) \ $(SOBJS) diff --git a/cpp/test/Ice/objects/Makefile.mak b/cpp/test/Ice/objects/Makefile.mak index 817da5bff99..57d1eaddae0 100644 --- a/cpp/test/Ice/objects/Makefile.mak +++ b/cpp/test/Ice/objects/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_objects_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -23,21 +25,21 @@ COLLOCATED = $(NAME_PREFIX)collocated TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) $(COLLOCATED)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Server.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj COLOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Collocated.obj \ - .\AllTests.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Collocated.obj \ + $(OBJDIR)\AllTests.obj OBJS = $(COBJS) \ $(SOBJS) \ diff --git a/cpp/test/Ice/operations/Makefile.mak b/cpp/test/Ice/operations/Makefile.mak index d8dbdd20c39..50c16e47503 100644 --- a/cpp/test/Ice/operations/Makefile.mak +++ b/cpp/test/Ice/operations/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_operations_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -24,36 +26,36 @@ COLLOCATED = $(NAME_PREFIX)collocated TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) $(SERVERAMD)$(EXT) $(COLLOCATED)$(EXT) -SLICE_OBJS = .\Test.obj .\TestAMD.obj - -COBJS = .\Test.obj \ - .\Client.obj \ - .\AllTests.obj \ - .\Twoways.obj \ - .\Oneways.obj \ - .\TwowaysAMI.obj \ - .\OnewaysAMI.obj \ - .\BatchOneways.obj \ - .\BatchOnewaysAMI.obj - -SOBJS = .\Test.obj \ - .\TestI.obj \ - .\Server.obj - -SAMDOBJS = .\TestAMD.obj \ - .\TestAMDI.obj \ - .\ServerAMD.obj - -COLOBJS = .\Test.obj \ - .\TestI.obj \ - .\Collocated.obj \ - .\AllTests.obj \ - .\Twoways.obj \ - .\Oneways.obj \ - .\TwowaysAMI.obj \ - .\OnewaysAMI.obj \ - .\BatchOneways.obj \ - .\BatchOnewaysAMI.obj +SLICE_OBJS = $(OBJDIR)\Test.obj $(OBJDIR)\TestAMD.obj + +COBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj \ + $(OBJDIR)\Twoways.obj \ + $(OBJDIR)\Oneways.obj \ + $(OBJDIR)\TwowaysAMI.obj \ + $(OBJDIR)\OnewaysAMI.obj \ + $(OBJDIR)\BatchOneways.obj \ + $(OBJDIR)\BatchOnewaysAMI.obj + +SOBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj + +SAMDOBJS = $(OBJDIR)\TestAMD.obj \ + $(OBJDIR)\TestAMDI.obj \ + $(OBJDIR)\ServerAMD.obj + +COLOBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Collocated.obj \ + $(OBJDIR)\AllTests.obj \ + $(OBJDIR)\Twoways.obj \ + $(OBJDIR)\Oneways.obj \ + $(OBJDIR)\TwowaysAMI.obj \ + $(OBJDIR)\OnewaysAMI.obj \ + $(OBJDIR)\BatchOneways.obj \ + $(OBJDIR)\BatchOnewaysAMI.obj OBJS = $(COBJS) \ $(SOBJS) \ diff --git a/cpp/test/Ice/optional/Makefile.mak b/cpp/test/Ice/optional/Makefile.mak index 4b8ed508c89..a937b36fcd2 100644 --- a/cpp/test/Ice/optional/Makefile.mak +++ b/cpp/test/Ice/optional/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_optional_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -23,20 +25,20 @@ SERVERAMD = $(NAME_PREFIX)serveramd TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) $(SERVERAMD)$(EXT) -SLICE_OBJS = .\Test.obj .\TestAMD.obj +SLICE_OBJS = $(OBJDIR)\Test.obj $(OBJDIR)\TestAMD.obj -COBJS = .\Test.obj \ - .\TestI.obj \ - .\Client.obj \ - .\AllTests.obj +COBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj -SOBJS = .\Test.obj \ - .\TestI.obj \ - .\Server.obj +SOBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj -SAMDOBJS = .\TestAMD.obj \ - .\TestAMDI.obj \ - .\ServerAMD.obj +SAMDOBJS = $(OBJDIR)\TestAMD.obj \ + $(OBJDIR)\TestAMDI.obj \ + $(OBJDIR)\ServerAMD.obj OBJS = $(COBJS) \ $(SOBJS) \ diff --git a/cpp/test/Ice/plugin/Makefile.mak b/cpp/test/Ice/plugin/Makefile.mak index e329c775bed..5a3c45e909b 100644 --- a/cpp/test/Ice/plugin/Makefile.mak +++ b/cpp/test/Ice/plugin/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_plugin_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -24,9 +26,9 @@ PLUGINDIR = plugins TARGETS = $(CLIENT)$(EXT) $(PLUGINDIR)\$(LIBNAME) $(PLUGINDIR)\$(DLLNAME) -COBJS = .\Client.obj +COBJS = $(OBJDIR)\Client.obj -POBJS = .\Plugin.obj +POBJS = $(OBJDIR)\Plugin.obj OBJS = $(COBJS) \ $(POBJS) diff --git a/cpp/test/Ice/proxy/AllTests.cpp b/cpp/test/Ice/proxy/AllTests.cpp index 818eca88858..6481aa4e130 100644 --- a/cpp/test/Ice/proxy/AllTests.cpp +++ b/cpp/test/Ice/proxy/AllTests.cpp @@ -977,7 +977,8 @@ allTests(const Ice::CommunicatorPtr& communicator) Ice::ObjectPrx p2 = communicator->stringToProxy("test -e 1.1:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); test(communicator->proxyToString(p2) == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"); - if(communicator->getProperties()->getPropertyAsInt("Ice.IPv6") == 0) + if(communicator->getProperties()->getPropertyAsInt("Ice.IPv6") == 0 && + communicator->getProperties()->getProperty("Ice.Default.Host") == "127.0.0.1") { // Working? #ifndef ICE_OS_WINRT diff --git a/cpp/test/Ice/proxy/Makefile.mak b/cpp/test/Ice/proxy/Makefile.mak index 62042136f73..8654b9907d9 100644 --- a/cpp/test/Ice/proxy/Makefile.mak +++ b/cpp/test/Ice/proxy/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_proxy_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -24,24 +26,24 @@ COLLOCATED = $(NAME_PREFIX)collocated TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) $(SERVERAMD)$(EXT) $(COLLOCATED)$(EXT) -SLICE_OBJS = .\Test.obj .\TestAMD.obj +SLICE_OBJS = $(OBJDIR)\Test.obj $(OBJDIR)\TestAMD.obj -COBJS = .\Test.obj \ - .\Client.obj \ - .\AllTests.obj +COBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj -SOBJS = .\Test.obj \ - .\TestI.obj \ - .\Server.obj +SOBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj -SAMDOBJS = .\TestAMD.obj \ - .\TestAMDI.obj \ - .\ServerAMD.obj +SAMDOBJS = $(OBJDIR)\TestAMD.obj \ + $(OBJDIR)\TestAMDI.obj \ + $(OBJDIR)\ServerAMD.obj -COLOBJS = .\Test.obj \ - .\TestI.obj \ - .\Collocated.obj \ - .\AllTests.obj +COLOBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Collocated.obj \ + $(OBJDIR)\AllTests.obj OBJS = $(COBJS) \ $(SOBJS) \ diff --git a/cpp/test/Ice/retry/Makefile.mak b/cpp/test/Ice/retry/Makefile.mak index 346a015b04f..e0845dfb7ec 100644 --- a/cpp/test/Ice/retry/Makefile.mak +++ b/cpp/test/Ice/retry/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_retry_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -23,22 +25,22 @@ COLLOCATED = $(NAME_PREFIX)collocated TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) $(COLLOCATED)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\Client.obj \ - .\InstrumentationI.obj \ - .\AllTests.obj + $(OBJDIR)\Client.obj \ + $(OBJDIR)\InstrumentationI.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Server.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj COLOBJS = $(SLICE_OBJS) \ - .\Collocated.obj \ - .\AllTests.obj \ - .\InstrumentationI.obj \ - .\TestI.obj + $(OBJDIR)\Collocated.obj \ + $(OBJDIR)\AllTests.obj \ + $(OBJDIR)\InstrumentationI.obj \ + $(OBJDIR)\TestI.obj OBJS = $(COBJS) \ $(SOBJS) \ diff --git a/cpp/test/Ice/servantLocator/Makefile.mak b/cpp/test/Ice/servantLocator/Makefile.mak index fcf7ffd831c..7bfe23b8176 100644 --- a/cpp/test/Ice/servantLocator/Makefile.mak +++ b/cpp/test/Ice/servantLocator/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_servantLocator_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -24,27 +26,27 @@ COLLOCATED = $(NAME_PREFIX)collocated TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) $(SERVERAMD)$(EXT) $(COLLOCATED)$(EXT) -SLICE_OBJS = .\Test.obj .\TestAMD.obj +SLICE_OBJS = $(OBJDIR)\Test.obj $(OBJDIR)\TestAMD.obj -COBJS = .\Test.obj \ - .\Client.obj \ - .\AllTests.obj +COBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj -SOBJS = .\Test.obj \ - .\TestI.obj \ - .\ServantLocatorI.obj \ - .\Server.obj +SOBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\ServantLocatorI.obj \ + $(OBJDIR)\Server.obj -SAMDOBJS = .\TestAMD.obj \ - .\TestAMDI.obj \ - .\ServantLocatorI.obj \ - .\ServerAMD.obj +SAMDOBJS = $(OBJDIR)\TestAMD.obj \ + $(OBJDIR)\TestAMDI.obj \ + $(OBJDIR)\ServantLocatorI.obj \ + $(OBJDIR)\ServerAMD.obj -COLOBJS = .\Test.obj \ - .\TestI.obj \ - .\ServantLocatorI.obj \ - .\Collocated.obj \ - .\AllTests.obj +COLOBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\ServantLocatorI.obj \ + $(OBJDIR)\Collocated.obj \ + $(OBJDIR)\AllTests.obj OBJS = $(COBJS) \ $(SOBJS) \ diff --git a/cpp/test/Ice/stream/Makefile.mak b/cpp/test/Ice/stream/Makefile.mak index 6ca0e3611c3..5440106f74f 100644 --- a/cpp/test/Ice/stream/Makefile.mak +++ b/cpp/test/Ice/stream/Makefile.mak @@ -12,19 +12,21 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_stream_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client TARGETS = $(CLIENT)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj OBJS = $(SLICE_OBJS) \ - .\Client.obj + $(OBJDIR)\Client.obj !include $(top_srcdir)/config/Make.rules.mak diff --git a/cpp/test/Ice/timeout/Makefile.mak b/cpp/test/Ice/timeout/Makefile.mak index e0c74bb79ac..43a069068a9 100644 --- a/cpp/test/Ice/timeout/Makefile.mak +++ b/cpp/test/Ice/timeout/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_timeout_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -22,16 +24,16 @@ SERVER = $(NAME_PREFIX)server TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Server.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj OBJS = $(COBJS) \ $(SOBJS) diff --git a/cpp/test/Ice/udp/Makefile.mak b/cpp/test/Ice/udp/Makefile.mak index c149726f223..613878325b9 100644 --- a/cpp/test/Ice/udp/Makefile.mak +++ b/cpp/test/Ice/udp/Makefile.mak @@ -12,9 +12,11 @@ top_srcdir = ..\..\.. !if "$(WINRT)" != "yes" NAME_PREFIX = EXT = .exe +OBJDIR = . !else NAME_PREFIX = Ice_udp_ EXT = .dll +OBJDIR = winrt !endif CLIENT = $(NAME_PREFIX)client @@ -22,15 +24,15 @@ SERVER = $(NAME_PREFIX)server TARGETS = $(CLIENT)$(EXT) $(SERVER)$(EXT) -SLICE_OBJS = .\Test.obj +SLICE_OBJS = $(OBJDIR)\Test.obj COBJS = $(SLICE_OBJS) \ - .\Client.obj \ - .\AllTests.obj + $(OBJDIR)\Client.obj \ + $(OBJDIR)\AllTests.obj SOBJS = $(SLICE_OBJS) \ - .\TestI.obj \ - .\Server.obj + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj OBJS = $(COBJS) \ $(SOBJS) diff --git a/cpp/test/WinRT/TestSuite/.gitignore b/cpp/test/WinRT/TestSuite/.gitignore new file mode 100644 index 00000000000..9b900765346 --- /dev/null +++ b/cpp/test/WinRT/TestSuite/.gitignore @@ -0,0 +1,2 @@ +Controller.cpp +Controller.h
\ No newline at end of file diff --git a/cpp/test/WinRT/TestSuite/App.xaml b/cpp/test/WinRT/TestSuite/App.xaml index b0b48e8abaf..4e4e56030a7 100644 --- a/cpp/test/WinRT/TestSuite/App.xaml +++ b/cpp/test/WinRT/TestSuite/App.xaml @@ -20,7 +20,7 @@ <Setter Property="FontSize" Value="16" /> </Style> <Style x:Key="OutputStyle" TargetType="TextBlock"> - <Setter Property="Foreground" Value="White" /> + <Setter Property="Foreground" Value="Black" /> <Setter Property="FontFamily" Value="Segoe UI Light" /> <Setter Property="FontSize" Value="16" /> </Style> diff --git a/cpp/test/WinRT/TestSuite/Controller.ice b/cpp/test/WinRT/TestSuite/Controller.ice new file mode 100644 index 00000000000..536e42895d9 --- /dev/null +++ b/cpp/test/WinRT/TestSuite/Controller.ice @@ -0,0 +1,33 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2015 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. +// +// ********************************************************************** + +module test +{ + +module Common +{ + +interface Server +{ + void waitTestSuccess(); + void waitForServer(); + void terminate(); +}; + +sequence<string> StringSeq; + +interface Controller +{ + Server* runServer(string lang, string name, string protocol, string host, bool winrt, + StringSeq options); +}; + +}; + +}; diff --git a/cpp/test/WinRT/TestSuite/MainPage.xaml b/cpp/test/WinRT/TestSuite/MainPage.xaml index bbd1ea2e2c6..984fc57185b 100644 --- a/cpp/test/WinRT/TestSuite/MainPage.xaml +++ b/cpp/test/WinRT/TestSuite/MainPage.xaml @@ -14,70 +14,141 @@ <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> - - <!-- Header --> <StackPanel Grid.Row="0"> - <TextBlock Text="ZeroC - Ice Test Suite" Style="{StaticResource TitleStyle}" - Margin="5, 5, 5, 5" + <TextBlock Text="ZeroC - Ice Test Suite" + Style="{StaticResource TitleStyle}" + Margin="5" VerticalAlignment="Bottom" TextWrapping="Wrap"/> </StackPanel> + <Hub Grid.Row="1" + Grid.Column="0" + Margin="0" + Padding="0"> + <HubSection Width="300" + VerticalContentAlignment="Stretch" + HorizontalContentAlignment="Stretch" + Padding="10" + Loaded="Tests_Loaded"> + <DataTemplate> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="*"/> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + <ListBox Grid.Row="0" + Grid.Column="0" + x:Name="ListBox" + Background="LightGray"></ListBox> + </Grid> + </DataTemplate> + </HubSection> - <!-- Content --> - <Grid Grid.Row="1"> - <Grid.RowDefinitions> - <RowDefinition Height="*"/> - </Grid.RowDefinitions> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="Auto"/> - <ColumnDefinition Width="*"/> - </Grid.ColumnDefinitions> - <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal"> - <ListBox x:Name="TestList" HorizontalAlignment="Left" - Padding="5, 5, 15, 5"> - </ListBox> - </StackPanel> - <Grid Grid.Row="0" Grid.Column="1"> - <Grid.RowDefinitions> - <RowDefinition Height="Auto"/> - <RowDefinition Height="*"/> - <RowDefinition Height="Auto"/> - </Grid.RowDefinitions> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="*"/> - </Grid.ColumnDefinitions> - <TextBlock Grid.Row="0" Grid.Column="0" - Style="{StaticResource H1Style}" - Text="Output" Margin="5, 5, 5, 5"/> - <Border Grid.Row="1" Grid.Column="0" BorderThickness="2" BorderBrush="Gray" Background="Gray"> - <ScrollViewer x:Name="Scroller" VerticalScrollBarVisibility="Auto" - HorizontalScrollBarVisibility="Disabled" - Width="Auto" Height="Auto" - ZoomMode="Disabled"> - <TextBlock x:Name="Output" Style="{StaticResource OutputStyle}" - Padding="5, 5, 5, 5" TextWrapping="Wrap"/> - </ScrollViewer> - </Border> - <Border Grid.Row="2" Padding="5, 5, 5, 5"> - <StackPanel Orientation="Horizontal"> - <Button x:Name="btnRun" Content="Run" Click="btnRun_Click"/> - <CheckBox x:Name="chkLoop" Content="Run In A Loop" Margin="10, 0, 0, 0"/> - <CheckBox x:Name="chkSerialize" Content="Enable Serialize Mode" Margin="10, 0, 0, 0"/> - <CheckBox x:Name="chkIPv6" Content="Use IPv6" Margin="10, 0, 0, 0"/> - <TextBlock Text="Protocol" Margin="10, 0, 0, 0" VerticalAlignment="Center" Style="{StaticResource BasicTextStyle}" FontSize="16"/> - <ComboBox x:Name="protocol" SelectedIndex="0" Margin="10, 0, 0, 0"> - <ComboBoxItem Name="tcp">tcp</ComboBoxItem> - <ComboBoxItem Name="ssl">ssl</ComboBoxItem> - <ComboBoxItem Name="ws">ws</ComboBoxItem> - <ComboBoxItem Name="wss">wss</ComboBoxItem> - </ComboBox> - </StackPanel> - </Border> - </Grid> - </Grid> - <!-- Footer --> + <HubSection Width="300" + Padding="5" + VerticalContentAlignment="Stretch" + HorizontalContentAlignment="Stretch" + Loaded="Configuration_Loaded"> + <DataTemplate> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="*"/> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + <StackPanel + Grid.Row="0" + Grid.Column="0" + VerticalAlignment="Stretch" + HorizontalAlignment="Stretch"> + <TextBlock Margin="5" + Text="Server" + Style="{StaticResource BasicTextStyle}" + FontSize="16"/> + <ComboBox Margin="5" + x:Name="Language" + SelectedIndex="0" + SelectionChanged="Language_SelectionChanged"> + <ComboBoxItem Name="winrt">winrt</ComboBoxItem> + <ComboBoxItem Name="cpp">C++</ComboBoxItem> + <ComboBoxItem Name="cs">C#</ComboBoxItem> + <ComboBoxItem Name="java">Java</ComboBoxItem> + </ComboBox> + <TextBlock Margin="5" + Text="Host" + Style="{StaticResource BasicTextStyle}" + FontSize="16"/> + <TextBox Padding="10" + x:Name="Host" + Text="127.0.0.1" + FontSize="16"/> + <TextBlock Margin="5" + Text="Protocol" + FontSize="16"/> + <ComboBox Margin="5" + x:Name="Protocol" + SelectedIndex="0"> + <ComboBoxItem Name="tcp">tcp</ComboBoxItem> + <ComboBoxItem Name="ssl">ssl</ComboBoxItem> + <ComboBoxItem Name="ws">ws</ComboBoxItem> + <ComboBoxItem Name="wss">wss</ComboBoxItem> + </ComboBox> + <CheckBox Margin="5" + x:Name="Loop" + Content="Run In A Loop" + FontSize="16"/> + <CheckBox Margin="5" + x:Name="Serialize" + Content="Enable Serialize Mode" + FontSize="16"/> + <CheckBox Margin="5" + x:Name="IPv6" + Content="Use IPv6" + FontSize="16"/> + <Button Margin="5" + x:Name="Run" + Content="Run" + Click="btnRun_Click" + HorizontalAlignment="Stretch" + FontSize="16"/> + <Button Margin="5" + x:Name="Stop" + Content="Stop" + Click="btnStop_Click" + HorizontalAlignment="Stretch" + FontSize="16"/> + </StackPanel> + </Grid> + </DataTemplate> + </HubSection> + <HubSection Width="800" + VerticalContentAlignment="Stretch" + HorizontalContentAlignment="Stretch" + Padding="10" + Loaded="Output_Loaded"> + <DataTemplate> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="*"/> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + <ListBox Grid.Row="0" + Grid.Column="0" + x:Name="Output" + Background="LightGray"></ListBox> + </Grid> + </DataTemplate> + </HubSection> + </Hub> <StackPanel Grid.Row="2" VerticalAlignment="Bottom"> - <TextBlock Margin="5, 5, 5, 5" Style="{StaticResource FooterStyle}" - Text="Copyright © 2012-2015 ZeroC, Inc. All rights reserved." TextWrapping="Wrap"/> + <TextBlock Text="Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved." + Style="{StaticResource FooterStyle}" + Margin="5" + TextWrapping="Wrap"/> </StackPanel> </Grid> </Page> diff --git a/cpp/test/WinRT/TestSuite/MainPage.xaml.cpp b/cpp/test/WinRT/TestSuite/MainPage.xaml.cpp index 0ef276c5298..6a37cf99bd0 100644 --- a/cpp/test/WinRT/TestSuite/MainPage.xaml.cpp +++ b/cpp/test/WinRT/TestSuite/MainPage.xaml.cpp @@ -11,10 +11,16 @@ #include <TestCommon.h> #include <string> #include <iostream> +#include <memory> #include <Ice/Ice.h> + +#include <Controller.h> + using namespace std; using namespace TestSuite; +using namespace test::Common; + using namespace Platform; using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; @@ -29,41 +35,12 @@ using namespace Windows::UI::Xaml::Navigation; using namespace Platform::Collections; -TextBlock^ output = nullptr; -ScrollViewer^ scroller = nullptr; -MainPage^ page = nullptr; - namespace { -void -printToConsoleOutput(const std::string& message) -{ - assert(output != nullptr); - String^ msg = ref new String(IceUtil::stringToWstring(message).c_str()); - output->Dispatcher->RunAsync(CoreDispatcherPriority::Normal, - ref new DispatchedHandler( - [msg] () - { - output->Text += msg; - output->UpdateLayout(); -#if (_WIN32_WINNT > 0x0602) - scroller->ChangeView(nullptr, scroller->ScrollableHeight, nullptr); -#else - scroller->ScrollToVerticalOffset(scroller->ScrollableHeight); -#endif - }, CallbackContext::Any)); -} +typedef int(*MAIN_ENTRY_POINT)(int, char**, Test::MainHelper*); -void -printLineToConsoleOutput(const std::string& msg) -{ - printToConsoleOutput(msg + '\n'); -} - -typedef int (*MAIN_ENTRY_POINT)(int, char**, Test::MainHelper*); - -typedef int (*SHUTDOWN_ENTRY_POINT)(); +typedef int(*SHUTDOWN_ENTRY_POINT)(); enum TestConfigType { TestConfigTypeClient, TestConfigTypeServer, TestConfigTypeColloc }; @@ -73,413 +50,656 @@ struct TestConfig string protocol; bool serialize; bool ipv6; + + string server; + string host; }; -bool +bool configUseWS(const TestConfig& config) { return config.protocol == "ws" || config.protocol == "wss"; } -bool +bool configUseSSL(const TestConfig& config) { return config.protocol == "ssl" || config.protocol == "wss"; } -class Runnable : public IceUtil::Thread, public Test::MainHelper +bool +isIn(const string s[], const string& name) { -public: - - Runnable(const string& test, const TestConfig& config) : - _test(test), - _config(config), - _started(false), - _completed(false), - _status(0) + int l = sizeof(s) / sizeof(string*); + for(int i = 0; i < l; ++i) { + if(s[i] == name) + { + return true; + } } + return false; +} + +static const string noSSL[] = +{ + "udp", + "metrics" +}; + +static const string noWS[] = +{ + "metrics" +}; + +static const string noIPv6[] = +{ + "metrics" +}; + +void +addConfiguration(const TestCasePtr& test, const string& name, const vector<string>& options = vector<string>(), + const vector<string>& languages = vector<string>()) +{ + TestConfigurationPtr configuration(new TestConfiguration(name, options, languages)); + test->configurations.push_back(configuration); +} + +vector<TestCasePtr> allTest(bool remoteserver) +{ + vector<TestCasePtr> all; + + TestCasePtr test; + TestConfigurationPtr configuration; + + test.reset(new TestCase("Ice", "adapterDeactivation", "client.dll", "server.dll", "", "collocated.dll")); + all.push_back(test); + + test.reset(new TestCase("Ice", "ami", "client.dll", "server.dll")); + all.push_back(test); + + test.reset(new TestCase("Ice", "binding", "client.dll", "server.dll")); + all.push_back(test); + + test.reset(new TestCase("Ice", "dispatcher", "client.dll", "server.dll")); + all.push_back(test); + + test.reset(new TestCase("Ice", "exceptions", "client.dll", "server.dll", "serveramd.dll", "collocated.dll")); + addConfiguration(test, "compact (default) format"); + addConfiguration(test, "sliced format", { "--Ice.Default.SlicedFormat" }); + addConfiguration(test, "1.0 encoding", { "--Ice.Default.EncodingVersion=1.0" }); + addConfiguration(test, "compact (default) format and AMD server"); + addConfiguration(test, "sliced format and AMD server", { "--Ice.Default.SlicedFormat" }); + addConfiguration(test, "1.0 encoding and AMD server", { "--Ice.Default.EncodingVersion=1.0" }); + all.push_back(test); + + test.reset(new TestCase("Ice", "facets", "client.dll", "server.dll", "", "collocated.dll")); + all.push_back(test); - virtual ~Runnable() + test.reset(new TestCase("Ice", "hold", "client.dll", "server.dll")); + all.push_back(test); + + test.reset(new TestCase("Ice", "info", "client.dll", "server.dll")); + all.push_back(test); + + test.reset(new TestCase("Ice", "inheritance", "client.dll", "server.dll", "", "collocated.dll")); + all.push_back(test); + + test.reset(new TestCase("Ice", "invoke", "client.dll", "server.dll")); + addConfiguration(test, "Blobject server", {}, { "cpp", "java", "C#" }); + addConfiguration(test, "BlobjectArray server", {}, { "cpp" }); + addConfiguration(test, "BlobjectAsync server", {}, { "cpp", "java", "C#" }); + addConfiguration(test, "BlobjectAsyncArray server", {}, { "cpp" }); + all.push_back(test); + + test.reset(new TestCase("Ice", "location", "client.dll", "server.dll")); + all.push_back(test); + + test.reset(new TestCase("Ice", "objects", "client.dll", "server.dll", "", "collocated.dll")); + addConfiguration(test, "compact (default) format"); + addConfiguration(test, "sliced format", { "--Ice.Default.SlicedFormat" }); + addConfiguration(test, "1.0 encoding", { "--Ice.Default.EncodingVersion=1.0" }); + all.push_back(test); + + test.reset(new TestCase("Ice", "operations", "client.dll", "server.dll", "serveramd.dll", "collocated.dll")); + addConfiguration(test, "regular server"); + addConfiguration(test, "AMD server"); + addConfiguration(test, "TIE server", {}, {"java", "C#"}); + addConfiguration(test, "AMD TIE server", {}, { "java", "C#" }); + all.push_back(test); + + test.reset(new TestCase("Ice", "proxy", "client.dll", "server.dll", "serveramd.dll", "collocated.dll")); + addConfiguration(test, "regular server"); + addConfiguration(test, "AMD server"); + all.push_back(test); + + test.reset(new TestCase("Ice", "retry", "client.dll", "server.dll")); + all.push_back(test); + + test.reset(new TestCase("Ice", "stream", "client.dll")); + all.push_back(test); + + test.reset(new TestCase("Ice", "timeout", "client.dll", "server.dll")); + all.push_back(test); + + test.reset(new TestCase("Ice", "acm", "client.dll", "server.dll")); + all.push_back(test); + + if(!remoteserver) { - if(_hnd != 0) - { - FreeLibrary(_hnd); - } + test.reset(new TestCase("Ice", "udp", "client.dll", "server.dll")); + all.push_back(test); } - - virtual void - run() + + test.reset(new TestCase("Ice", "hash", "client.dll")); + all.push_back(test); + + if(!remoteserver) { - _hnd = LoadPackagedLibrary(IceUtil::stringToWstring(_test).c_str(), 0); - if(_hnd == 0) - { - ostringstream os; - os << "failed to load `" << _test + "': error code: " << GetLastError(); - printLineToConsoleOutput(os.str()); - completed(-1); - return; - } + test.reset(new TestCase("Ice", "metrics", "client.dll", "server.dll", "serveramd.dll")); + all.push_back(test); + } - _dllTestShutdown = GetProcAddress(_hnd, "dllTestShutdown"); - if(_dllTestShutdown == 0) - { - printLineToConsoleOutput("failed to find dllTestShutdown function from `" + _test + "'"); - completed(-1); - return; - } + test.reset(new TestCase("Ice", "optional", "client.dll", "server.dll")); + addConfiguration(test, "compact (default) format"); + addConfiguration(test, "sliced format", { "--Ice.Default.SlicedFormat" }); + addConfiguration(test, "AMD server"); + all.push_back(test); - FARPROC dllMain = GetProcAddress(_hnd, "dllMain"); - if(dllMain == 0) - { - printLineToConsoleOutput("failed to find dllMain function from `" + _test + "'"); - completed(-1); - return; - } + test.reset(new TestCase("Ice", "admin", "client.dll", "server.dll")); + all.push_back(test); - vector<string> args; - // - // NOTE: When testing for SSL on a WinRT device, this needs to - // be set to the IP addresse of the host running the SSL - // server. - // - args.push_back("--Ice.NullHandleAbort=1"); - args.push_back("--Ice.Warn.Connections=1"); - //args.push_back("--Ice.Trace.Network=2"); - //args.push_back("--Ice.Trace.Protocol=2"); - args.push_back("--Ice.ProgramName=" + _test); - if(_config.serialize) - { - args.push_back("--Ice.ThreadPool.Server.Serialize=1"); - } + test.reset(new TestCase("Ice", "enums", "client.dll", "server.dll")); + addConfiguration(test, "1.0 encoding", { "--Ice.Default.EncodingVersion=1.0" }); + addConfiguration(test, "1.1 encoding"); - if(_config.ipv6) - { - args.push_back("--Ice.Default.Host=0:0:0:0:0:0:0:1"); - args.push_back("--Ice.IPv4=1"); - args.push_back("--Ice.IPv6=1"); - args.push_back("--Ice.PreferIPv6Address=1"); - } - else - { - args.push_back("--Ice.Default.Host=127.0.0.1"); - args.push_back("--Ice.IPv4=1"); - args.push_back("--Ice.IPv6=0"); - } + all.push_back(test); - if(_config.type != TestConfigTypeClient) - { - args.push_back("--Ice.ThreadPool.Server.Size=1"); - args.push_back("--Ice.ThreadPool.Server.SizeMax=3"); - args.push_back("--Ice.ThreadPool.Server.SizeWarn=0"); - } + return all; +} - args.push_back("--Ice.Default.Protocol=" + _config.protocol); +class TestRunner; +typedef IceUtil::Handle<TestRunner> TestRunnerPtr; - char** argv = new char*[args.size() + 1]; - for(unsigned int i = 0; i < args.size(); ++i) - { - argv[i] = const_cast<char*>(args[i].c_str()); - } - argv[args.size()] = 0; - int status = EXIT_FAILURE; - try - { - status = reinterpret_cast<MAIN_ENTRY_POINT>(dllMain)(static_cast<int>(args.size()), argv, this); - } - catch(const std::exception& ex) - { - print("unexpected exception while running `" + _test + "':\n" + ex.what()); - } - catch(...) - { - print("unexpected unknown exception while running `" + _test + "'"); - } +class Runnable : public IceUtil::Thread, public Test::MainHelper +{ +public: + + Runnable(const TestRunnerPtr&, const string&, const TestConfig&, const vector<string>& options = vector<string>()); + virtual ~Runnable(); + virtual void run(); + void waitForStart(); + virtual void waitForCompleted(); + virtual void serverReady(); + virtual void shutdown(); + virtual bool redirect(); + virtual void print(const string& message); + int status(); + +private: + + void completed(int); + + IceUtil::Monitor<IceUtil::Mutex> _monitor; + TestRunnerPtr _runner; + string _test; + TestConfig _config; + bool _started; + bool _completed; + int _status; + Ice::CommunicatorPtr _communicator; + FARPROC _dllTestShutdown; + HINSTANCE _hnd; + vector<string> _options; +}; +typedef IceUtil::Handle<Runnable> RunnablePtr; + +class TestRunner : public IceUtil::Thread +{ +public: + + TestRunner(const std::shared_ptr<TestCase>&, const TestConfig&, MainPage^, + Vector<Platform::String^>^, ListBox^, const Ice::CommunicatorPtr&); + virtual void run(); + void runClientServerTest(const string&, const string&); + void runClientServerTestWithRemoteServer(const string&); + void runClientTest(const string&, bool); + + void printToConsoleOutput(const std::string&); + void printLineToConsoleOutput(const std::string&); + +private: + + std::shared_ptr<TestCase> _test; + TestConfig _config; + MainPage^ _page; + Vector<Platform::String^>^ _messages; + ListBox^ _output; + Ice::CommunicatorPtr _communicator; +}; + +Runnable::Runnable(const TestRunnerPtr& runner, const string& test, const TestConfig& config, const vector<string>& options) : + _runner(runner), + _test(test), + _config(config), + _started(false), + _completed(false), + _status(0), + _options(options) +{ +} - completed(status); - delete[] argv; +Runnable::~Runnable() +{ + if(_hnd != 0) + { + FreeLibrary(_hnd); } - - void - waitForStart() +} + +void +Runnable::run() +{ + _hnd = LoadPackagedLibrary(IceUtil::stringToWstring(_test).c_str(), 0); + if(_hnd == 0) { - IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor); - while(!_started && !_completed) - { - _monitor.wait(); - } - if(_completed && _status != 0) - { - ostringstream os; - os << "failed with status = " << _status; - throw os.str(); - } + ostringstream os; + os << "failed to load `" << _test + "': error code: " << GetLastError(); + _runner->printLineToConsoleOutput(os.str()); + completed(-1); + return; } - - virtual void - waitForCompleted() + + _dllTestShutdown = GetProcAddress(_hnd, "dllTestShutdown"); + if(_dllTestShutdown == 0) { - IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor); - while(!_completed) - { - _monitor.wait(); - } - if(_status != 0) - { - ostringstream os; - os << "failed with status = " << _status; - throw os.str(); - } + _runner->printLineToConsoleOutput("failed to find dllTestShutdown function from `" + _test + "'"); + completed(-1); + return; } - // - // MainHelper implementation - // + FARPROC dllMain = GetProcAddress(_hnd, "dllMain"); + if(dllMain == 0) + { + _runner->printLineToConsoleOutput("failed to find dllMain function from `" + _test + "'"); + completed(-1); + return; + } - virtual void - serverReady() + vector<string> args; + args.push_back("--Ice.NullHandleAbort=1"); + args.push_back("--Ice.Warn.Connections=1"); + args.push_back("--Ice.ProgramName=" + _test); + if(_config.serialize) { - IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor); - _started = true; - _monitor.notify(); + args.push_back("--Ice.ThreadPool.Server.Serialize=1"); } - virtual void - shutdown() + if(_config.ipv6) { - if(_dllTestShutdown) - { - reinterpret_cast<SHUTDOWN_ENTRY_POINT>(_dllTestShutdown)(); - } + args.push_back("--Ice.Default.Host=0:0:0:0:0:0:0:1"); + args.push_back("--Ice.IPv4=1"); + args.push_back("--Ice.IPv6=1"); + args.push_back("--Ice.PreferIPv6Address=1"); } - - virtual bool - redirect() + else { - return _config.type == TestConfigTypeClient || _config.type == TestConfigTypeColloc; + args.push_back("--Ice.Default.Host=127.0.0.1"); + args.push_back("--Ice.IPv4=1"); + args.push_back("--Ice.IPv6=0"); } - virtual void - print(const string& message) + if(_config.type != TestConfigTypeClient) { - printToConsoleOutput(message); + args.push_back("--Ice.ThreadPool.Server.Size=1"); + args.push_back("--Ice.ThreadPool.Server.SizeMax=3"); + args.push_back("--Ice.ThreadPool.Server.SizeWarn=0"); } - int - status() + args.push_back("--Ice.Default.Host=" + _config.host); + args.push_back("--Ice.Default.Protocol=" + _config.protocol); + + for(vector<string>::const_iterator i = _options.begin(); i != _options.end(); i++) { - IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor); - return _status; + args.push_back(*i); } -private: + char** argv = new char*[args.size() + 1]; + for(unsigned int i = 0; i < args.size(); ++i) + { + argv[i] = const_cast<char*>(args[i].c_str()); + } + argv[args.size()] = 0; + int status = EXIT_FAILURE; + try + { + status = reinterpret_cast<MAIN_ENTRY_POINT>(dllMain)(static_cast<int>(args.size()), argv, this); + } + catch(const std::exception& ex) + { + print("unexpected exception while running `" + _test + "':\n" + ex.what()); + } + catch(...) + { + print("unexpected unknown exception while running `" + _test + "'"); + } - void - completed(int status) + completed(status); + delete[] argv; +} + +void +Runnable::waitForStart() +{ + IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor); + while(!_started && !_completed) { - IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor); - _completed = true; - _status = status; - _monitor.notify(); + _monitor.wait(); } + if(_completed && _status != 0) + { + ostringstream os; + os << "failed with status = " << _status; + throw os.str(); + } +} - IceUtil::Monitor<IceUtil::Mutex> _monitor; - string _test; - TestConfig _config; - bool _started; - bool _completed; - int _status; - Ice::CommunicatorPtr _communicator; - FARPROC _dllTestShutdown; - HINSTANCE _hnd; -}; -typedef IceUtil::Handle<Runnable> RunnablePtr; +void +Runnable::waitForCompleted() +{ + IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor); + while(!_completed) + { + _monitor.wait(); + } + if(_status != 0) + { + ostringstream os; + os << "failed with status = " << _status; + throw os.str(); + } +} -bool -isIn(const string s[], const string& name) +void +Runnable::serverReady() { - int l = sizeof(s)/sizeof(string*); - for(int i = 0; i < l; ++i) + IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor); + _started = true; + _monitor.notify(); +} + +void +Runnable::shutdown() +{ + if(_dllTestShutdown) { - if(s[i] == name) - { - return true; - } + reinterpret_cast<SHUTDOWN_ENTRY_POINT>(_dllTestShutdown)(); } - return false; } -static const string noSSL[] = +bool +Runnable::redirect() { - "udp", - "metrics" -}; + return _config.type == TestConfigTypeClient || _config.type == TestConfigTypeColloc; +} -static const string noWS[] = +void +Runnable::print(const string& message) { - "metrics" -}; + _runner->printToConsoleOutput(message); +} -static const string noIPv6[] = +int +Runnable::status() { - "metrics" -}; + IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor); + return _status; +} -struct TestCase -{ - TestCase(const string& module, const string& name, const char* client, const char* server, - const char* serverAMD = 0, const char* collocated = 0) : - name(module + "\\" + name), - prefix(module + "_" + name + "_"), - client(client), - server(server), - serverAMD(serverAMD), - collocated(collocated), - sslSupport(!isIn(noSSL, name)), - ipv6Support(!isIn(noIPv6, name)), - wsSupport(!isIn(noWS, name)) - { - } - - string name; - string prefix; - const char* client; - const char* server; - const char* serverAMD; - const char* collocated; - bool sslSupport; - bool ipv6Support; - bool wsSupport; -}; +void +Runnable::completed(int status) +{ + IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor); + _completed = true; + _status = status; + _monitor.notify(); +} -static const TestCase allTest[] = -{ - TestCase("Ice", "adapterDeactivation", "client.dll", "server.dll", 0, "collocated.dll"), - TestCase("Ice", "ami", "client.dll", "server.dll", 0, 0), - TestCase("Ice", "binding", "client.dll", "server.dll", 0, 0), - TestCase("Ice", "dispatcher", "client.dll", "server.dll", 0, 0), - TestCase("Ice", "exceptions", "client.dll", "server.dll", "serveramd.dll", "collocated.dll"), - TestCase("Ice", "facets", "client.dll", "server.dll", 0, "collocated.dll"), - TestCase("Ice", "hold", "client.dll", "server.dll", 0, 0), - TestCase("Ice", "info", "client.dll", "server.dll", 0, 0), - TestCase("Ice", "inheritance", "client.dll", "server.dll", 0, "collocated.dll"), - TestCase("Ice", "invoke", "client.dll", "server.dll", 0, 0), - TestCase("Ice", "location", "client.dll", "server.dll", 0, 0), - TestCase("Ice", "objects", "client.dll", "server.dll", 0, "collocated.dll"), - TestCase("Ice", "operations", "client.dll", "server.dll", "serveramd.dll", "collocated.dll"), - TestCase("Ice", "proxy", "client.dll", "server.dll", "serveramd.dll", "collocated.dll"), - TestCase("Ice", "retry", "client.dll", "server.dll", 0, 0), - TestCase("Ice", "stream", "client.dll", 0, 0, 0), - TestCase("Ice", "timeout", "client.dll", "server.dll", 0, 0), - TestCase("Ice", "acm", "client.dll", "server.dll", 0, 0), - TestCase("Ice", "udp", "client.dll", "server.dll", 0, 0), - TestCase("Ice", "hash", "client.dll", 0, 0, 0), - TestCase("Ice", "metrics", "client.dll", "server.dll", "serveramd.dll", 0), - TestCase("Ice", "optional", "client.dll", "server.dll", 0, 0), - TestCase("Ice", "admin", "client.dll", "server.dll", 0, 0), - TestCase("Ice", "enums", "client.dll", "server.dll", 0, 0), -}; +TestRunner::TestRunner(const TestCasePtr& test, const TestConfig& config, MainPage^ page, + Vector<Platform::String^>^ messages, ListBox^ output, + const Ice::CommunicatorPtr& communicator) : + _test(test), + _config(config), + _page(page), + _messages(messages), + _output(output), + _communicator(communicator) +{ +} -class TestRunner : public IceUtil::Thread +void +TestRunner::printToConsoleOutput(const std::string& message) { -public: + vector<string> lines; + string::size_type pos = 0; + string data = message; + while((pos = data.find("\n")) != string::npos) + { + lines.push_back(data.substr(0, pos)); + data = data.substr(pos + 1); + } + lines.push_back(data); + + for(vector<string>::const_iterator i = lines.begin(); i != lines.end(); ++i) + { + _page->printToConsoleOutput(ref new String(IceUtil::stringToWstring(*i).c_str()), i != lines.begin()); + } +} - TestRunner(const TestCase& test, const TestConfig& config) : _test(test), _config(config) - { - } +void +TestRunner::printLineToConsoleOutput(const std::string& msg) +{ + printToConsoleOutput(msg + '\n'); +} - virtual void - run() +void +TestRunner::run() +{ + try { - try + if(configUseWS(_config) && !_test->wsSupport) { - if(configUseWS(_config) && !_test.wsSupport) - { - printLineToConsoleOutput("**** test " + _test.name + " not supported with WS"); - } - else if(configUseSSL(_config) && !_test.sslSupport) - { - printLineToConsoleOutput("**** test " + _test.name + " not supported with SSL"); - } - else if(_config.ipv6 && !_test.ipv6Support) - { - printLineToConsoleOutput("**** test " + _test.name + " not supported with IPv6"); - } - else if(configUseSSL(_config) && _config.ipv6) - { - printLineToConsoleOutput("**** test " + _test.name + " not supported with IPv6 SSL"); - } - else + printLineToConsoleOutput("**** test " + _test->name + " not supported with WS"); + } + else if(configUseSSL(_config) && !_test->sslSupport) + { + printLineToConsoleOutput("**** test " + _test->name + " not supported with SSL"); + } + else if(_config.ipv6 && !_test->ipv6Support) + { + printLineToConsoleOutput("**** test " + _test->name + " not supported with IPv6"); + } + else if(configUseSSL(_config) && _config.ipv6) + { + printLineToConsoleOutput("**** test " + _test->name + " not supported with IPv6 SSL"); + } + else + { + if(!_test->server.empty()) { - if(_test.server) + if(_config.server == "winrt") { - printLineToConsoleOutput("**** running test " + _test.name); - runClientServerTest(_test.server, _test.client); - printLineToConsoleOutput(""); + printLineToConsoleOutput("**** running test " + _test->name); + runClientServerTest(_test->server, _test->client); } else { - assert(_test.client); - printLineToConsoleOutput("**** running test " + _test.name); - runClientTest(_test.client, false); - printLineToConsoleOutput(""); - } - - if(_test.serverAMD) - { - printLineToConsoleOutput("*** running test with AMD server " + _test.name); - runClientServerTest(_test.server, _test.client); - printLineToConsoleOutput(""); + printLineToConsoleOutput("**** running test " + _test->name); + runClientServerTestWithRemoteServer(_test->client); } + } + else + { + assert(!_test->client.empty()); + printLineToConsoleOutput("**** running test " + _test->name); + runClientTest(_test->client, false); + } - // - // Don't run collocated tests with SSL as there isn't SSL server side. - // - if(_test.collocated && !configUseSSL(_config)) - { - printLineToConsoleOutput("*** running collocated test " + _test.name); - runClientTest(_test.collocated, true); - printLineToConsoleOutput(""); - } + if(!_test->serverAMD.empty() && _config.server == "winrt") + { + printLineToConsoleOutput("*** running test with AMD server " + _test->name); + runClientServerTest(_test->server, _test->client); } - page->completed(); - } - catch(Platform::Exception^ ex) - { - page->failed(ex->Message); - } - catch(const std::exception& ex) - { - page->failed(ref new String(IceUtil::stringToWstring(ex.what()).c_str())); - } - catch(const string& ex) - { - page->failed(ref new String(IceUtil::stringToWstring(ex).c_str())); + // + // Don't run collocated tests with SSL as there isn't SSL server side. + // + if(!_test->collocated.empty() && !configUseSSL(_config) && _config.server == "winrt") + { + printLineToConsoleOutput("*** running collocated test " + _test->name); + runClientTest(_test->collocated, true); + } } - catch(...) + _page->completed(); + } + catch(Platform::Exception^ ex) + { + _page->failed(ex->Message); + } + catch(const std::exception& ex) + { + _page->failed(ref new String(IceUtil::stringToWstring(ex.what()).c_str())); + } + catch(const string& ex) + { + _page->failed(ref new String(IceUtil::stringToWstring(ex).c_str())); + } + catch(...) + { + _page->failed("unknown exception"); + } +} + +void +TestRunner::runClientServerTest(const string& server, const string& client) +{ + RunnablePtr serverRunable; + TestConfig svrConfig = _config; + svrConfig.type = TestConfigTypeServer; + serverRunable = new Runnable(this, _test->prefix + server, svrConfig); + serverRunable->start(); + serverRunable->getThreadControl().detach(); + serverRunable->waitForStart(); + + TestConfig cltConfig = _config; + cltConfig.type = TestConfigTypeClient; + RunnablePtr clientRunable = new Runnable(this, _test->prefix + client, cltConfig); + clientRunable->start(); + clientRunable->getThreadControl().detach(); + + try + { + clientRunable->waitForCompleted(); + } + catch(...) + { + if(serverRunable) { - page->failed("unknown exception"); + serverRunable->shutdown(); + serverRunable->waitForCompleted(); } + throw; + } + + if(serverRunable) + { + serverRunable->waitForCompleted(); + } +} + +string +createProxy(const string id, TestConfig config) +{ + ostringstream os; + os << id << ":" << config.protocol << " -t 10000 -h " << config.host << " -p "; + if(config.protocol == "tcp") + { + os << 15000; + } + else if(config.protocol == "ssl") + { + os << 15001; + } + else if(config.protocol == "ws") + { + os << 15002; + } + else if(config.protocol == "wss") + { + os << 15003; + } + return os.str(); +} + +void +TestRunner::runClientServerTestWithRemoteServer(const string& client) +{ + RunnablePtr serverRunable; + ControllerPrx controller = ControllerPrx::uncheckedCast( + _communicator->stringToProxy(createProxy("controller", _config))); + StringSeq options; + if(_config.serialize) + { + options.push_back("Ice.ThreadPool.Server.Serialize=1"); + } + + if(_config.ipv6) + { + options.push_back("Ice.IPv4=1"); + options.push_back("Ice.IPv6=1"); + options.push_back("Ice.PreferIPv6Address=1"); + } + else + { + options.push_back("Ice.IPv4=1"); + options.push_back("Ice.IPv6=0"); + } + + ServerPrx server = + controller->runServer(_config.server, _test->name, _config.protocol, _config.host, true, options); + + server = ServerPrx::uncheckedCast( + _communicator->stringToProxy(createProxy(server->ice_getIdentity().name, _config))); + + vector<TestConfigurationPtr> configurations; + if(_test->configurations.empty()) + { + TestConfigurationPtr configuration(new TestConfiguration()); + configurations.push_back(configuration); } - - void - runClientServerTest(const string& server, const string& client) + else { - RunnablePtr serverRunable; - if(!configUseSSL(_config)) + configurations = _test->configurations; + } + + for(vector<TestConfigurationPtr>::const_iterator i = configurations.begin(); + i != configurations.end(); ++i) + { + TestConfigurationPtr configuration = *i; + if(!configuration->languages.empty() && + find(configuration->languages.begin(), + configuration->languages.end(), _config.server) == configuration->languages.end()) { - TestConfig svrConfig = _config; - svrConfig.type = TestConfigTypeServer; - serverRunable = new Runnable(_test.prefix + server, svrConfig); - serverRunable->start(); - serverRunable->getThreadControl().detach(); - serverRunable->waitForStart(); + continue; } + printLineToConsoleOutput("*** Running test with " + + (configuration->name.empty() ? "regular server" : configuration->name)); + server->waitForServer(); + TestConfig cltConfig = _config; cltConfig.type = TestConfigTypeClient; - RunnablePtr clientRunable = new Runnable(_test.prefix + client, cltConfig); + RunnablePtr clientRunable = new Runnable(this, _test->prefix + client, cltConfig, configuration->options); clientRunable->start(); clientRunable->getThreadControl().detach(); @@ -489,63 +709,97 @@ public: } catch(...) { - if(serverRunable) + if(server) { - serverRunable->shutdown(); - serverRunable->waitForCompleted(); + try + { + server->terminate(); + } + catch(const Ice::LocalException&) + { + } } throw; } - - if(serverRunable) - { - serverRunable->waitForCompleted(); - } } +} - void - runClientTest(const string& client, bool collocated) - { - TestConfig cltConfig = _config; - cltConfig.type = collocated ? TestConfigTypeColloc : TestConfigTypeClient; - RunnablePtr clientRunable = new Runnable(_test.prefix + client, cltConfig); - clientRunable->start(); - clientRunable->getThreadControl().detach(); - clientRunable->waitForCompleted(); - } - -private: - - TestCase _test; - TestConfig _config; -}; +void +TestRunner::runClientTest(const string& client, bool collocated) +{ + TestConfig cltConfig = _config; + cltConfig.type = collocated ? TestConfigTypeColloc : TestConfigTypeClient; + RunnablePtr clientRunable = new Runnable(this, _test->prefix + client, cltConfig); + clientRunable->start(); + clientRunable->getThreadControl().detach(); + clientRunable->waitForCompleted(); +} -typedef IceUtil::Handle<TestRunner> TestRunnerPtr; +} +TestConfiguration::TestConfiguration(const string& name, const vector<string>& options, + const vector<string>& languages) : + name(name), + options(options), + languages(languages) +{ } -// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 +TestCase::TestCase(const string& module, const string& name, const string& client, const string& server, + const string& serverAMD, const string& collocated) : + name(module + "/" + name), + prefix(module + "_" + name + "_"), + client(client), + server(server), + serverAMD(serverAMD), + collocated(collocated), + sslSupport(!isIn(noSSL, name)), + ipv6Support(!isIn(noIPv6, name)), + wsSupport(!isIn(noWS, name)) +{ +} -MainPage::MainPage() +MainPage::MainPage() : + _names(ref new Vector<String^>()), + _protocols(ref new Vector<String^>()), + _messages(ref new Vector<String^>()) { - _names = ref new Vector<String^>(); - for(int i = 0; i < sizeof(allTest)/sizeof(allTest[0]); ++i) - { - _names->Append(ref new String(IceUtil::stringToWstring(allTest[i].name).c_str())); - } InitializeComponent(); - page = this; - output = Output; - scroller = Scroller; - TestList->ItemsSource = _names; - TestList->SelectedIndex = 0; } -/// <summary> -/// Invoked when this page is about to be displayed in a Frame. -/// </summary> -/// <param name="e">Event data that describes how this page was reached. The Parameter -/// property is typically used to configure the page.</param> +void +MainPage::Tests_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + _tests = findChild<ListBox>(this, "ListBox"); + _tests->ItemsSource = _names; +} + +void +MainPage::Output_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + _output = findChild<ListBox>(this, "Output"); + _output->ItemsSource = _messages; +} + +void +MainPage::Configuration_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + _language = findChild<ComboBox>(this, "Language"); + + _host = findChild<TextBox>(this, "Host"); + _host->IsEnabled = false; + + _protocol = findChild<ComboBox>(this, "Protocol"); + _loop = findChild<CheckBox>(this, "Loop"); + _serialize = findChild<CheckBox>(this, "Serialize"); + _ipv6 = findChild<CheckBox>(this, "IPv6"); + _run = findChild<Button>(this, "Run"); + _stop = findChild<Button>(this, "Stop"); + _stop->IsEnabled = false; + + initializeSupportedProtocols(); + initializeSupportedTests(); +} void MainPage::OnNavigatedTo(NavigationEventArgs^ e) @@ -553,64 +807,196 @@ MainPage::OnNavigatedTo(NavigationEventArgs^ e) (void) e; // Unused parameter } - void MainPage::failed(String^ msg) { - printLineToConsoleOutput("Test failed"); - printLineToConsoleOutput(IceUtil::wstringToString(msg->Data())); + _messages->Append(ref new String(L"Test failed")); + _messages->Append(msg); completed(); } void MainPage::completed() { - page->Dispatcher->RunAsync( - CoreDispatcherPriority::Normal, - ref new DispatchedHandler([=] () - { - if(!chkLoop->IsChecked->Value) - { - TestList->IsEnabled = true; - btnRun->IsEnabled = true; - return; - } - TestList->IsEnabled = true; - if(TestList->SelectedIndex == (sizeof(allTest)/sizeof(allTest[0])) -1) - { - TestList->SelectedIndex = 0; - } - else - { - TestList->SelectedIndex++; - } - TestList->IsEnabled = false; - runSelectedTest(); - })); + Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler( + [=] () + { + if(!_loop->IsChecked->Value) + { + _tests->IsEnabled = true; + _protocol->IsEnabled = true; + if(selectedLanguage() != "winrt") + { + _host->IsEnabled = true; + } + _language->IsEnabled = true; + _loop->IsEnabled = true; + _serialize->IsEnabled = true; + _ipv6->IsEnabled = true; + _run->IsEnabled = true; + _stop->Content = "Stop"; + return; + } + _tests->IsEnabled = true; + if(_tests->SelectedIndex == _allTests.size() - 1) + { + _tests->SelectedIndex = 0; + } + else + { + _tests->SelectedIndex++; + } + _tests->IsEnabled = false; + runSelectedTest(); + })); } void MainPage::btnRun_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) { - if(TestList->SelectedIndex >= 0 && TestList->SelectedIndex < sizeof(allTest)/sizeof(allTest[0])) + if(_tests->SelectedIndex >= 0 && _tests->SelectedIndex < static_cast<int>(_allTests.size())) { - TestList->IsEnabled = false; - btnRun->IsEnabled = false; - output->Text = ""; + _tests->IsEnabled = false; + _protocol->IsEnabled = false; + _host->IsEnabled = false; + _language->IsEnabled = false; + _loop->IsEnabled = false; + _serialize->IsEnabled = false; + _ipv6->IsEnabled = false; + _run->IsEnabled = false; + _stop->IsEnabled = _loop->IsChecked->Value; + _messages->Clear(); runSelectedTest(); } } +void +MainPage::btnStop_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + _loop->IsChecked = false; + _stop->IsEnabled = false; + _stop->Content = "Wainting for test to finish..."; +} + +Ice::CommunicatorPtr +MainPage::communicator() +{ + if(!_communicator) + { + _communicator = Ice::initialize(); + } + return _communicator; +} + void MainPage::runSelectedTest() { - static const string protocols[] = { "tcp", "ssl", "ws", "wss" }; TestConfig config; - config.protocol = protocols[protocol->SelectedIndex]; - config.serialize = chkSerialize->IsChecked->Value; - config.ipv6 = chkIPv6->IsChecked->Value; + config.protocol = selectedProtocol(); + config.serialize = _serialize->IsChecked->Value; + config.ipv6 = _ipv6->IsChecked->Value; + + config.server = selectedLanguage(); + config.host = IceUtil::wstringToString(_host->Text->Data()); - TestRunnerPtr t = new TestRunner(allTest[TestList->SelectedIndex], config); + TestRunnerPtr t = new TestRunner(_allTests[_tests->SelectedIndex], config, this, _messages, _output, communicator()); t->start(); t->getThreadControl().detach(); } + +void +TestSuite::MainPage::initializeSupportedTests() +{ + _allTests = allTest(selectedLanguage() != "winrt"); + _names->Clear(); + for(vector<TestCasePtr>::const_iterator i = _allTests.begin(); i != _allTests.end(); ++i) + { + TestCasePtr test = *i; + _names->Append(ref new String(IceUtil::stringToWstring(test->name).c_str())); + } + _tests->SelectedIndex = 0; +} + +void +TestSuite::MainPage::initializeSupportedProtocols() +{ + _protocols->Clear(); + if(selectedLanguage() == "winrt") + { + _protocols->Append("tcp"); + _protocols->Append("ws"); + } + else + { + _protocols->Append("tcp"); + _protocols->Append("ssl"); + _protocols->Append("ws"); + _protocols->Append("wss"); + } + + _protocol->ItemsSource = _protocols; + _protocol->SelectedIndex = 0; +} + +std::string +TestSuite::MainPage::selectedProtocol() +{ + if(selectedLanguage() == "winrt") + { + const char* protocols[] = { "tcp", "ws" }; + assert(_protocol->SelectedIndex < sizeof(protocols) / sizeof(const char*)); + return protocols[_protocol->SelectedIndex]; + } + else + { + const char* protocols[] = { "tcp", "ssl", "ws", "wss" }; + assert(_protocol->SelectedIndex < sizeof(protocols) / sizeof(const char*)); + return protocols[_protocol->SelectedIndex]; + } +} +std::string +TestSuite::MainPage::selectedLanguage() +{ + static const char* languages[] = {"winrt", "cpp", "cs", "java"}; + assert(_language->SelectedIndex < sizeof(languages) / sizeof(const char*)); + return languages[_language->SelectedIndex]; +} + +void +TestSuite::MainPage::Language_SelectionChanged(Platform::Object^ sender, SelectionChangedEventArgs^ e) +{ + if(_language) + { + _host->IsEnabled = selectedLanguage() != "winrt"; + initializeSupportedTests(); + initializeSupportedProtocols(); + } +} + +void +TestSuite::MainPage::printToConsoleOutput(String^ message, bool newline) +{ + _output->Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler( + [=]() + { + if(newline) + { + _messages->Append(ref new String(L"")); + } + + if(_messages->Size > 0) + { + String^ item = _messages->GetAt(_messages->Size - 1); + wstring s(item->Data()); + s += wstring(message->Data()); + _messages->SetAt(_messages->Size - 1, ref new String(s.c_str())); + } + else + { + _messages->Append(message); + } + + _output->SelectedIndex = _messages->Size - 1; + _output->ScrollIntoView(_output->SelectedItem); + }, CallbackContext::Any)); +}
\ No newline at end of file diff --git a/cpp/test/WinRT/TestSuite/MainPage.xaml.h b/cpp/test/WinRT/TestSuite/MainPage.xaml.h index 94f2fb19d9c..ccf32dfda38 100644 --- a/cpp/test/WinRT/TestSuite/MainPage.xaml.h +++ b/cpp/test/WinRT/TestSuite/MainPage.xaml.h @@ -11,12 +11,70 @@ #include "MainPage.g.h" #include <collection.h> +#include <vector> +#include <memory> + +#include <Ice/Ice.h> namespace TestSuite { -/// <summary> -/// An empty page that can be used on its own or navigated to within a Frame. -/// </summary> + +struct TestConfiguration +{ + TestConfiguration(const std::string& name = "", + const std::vector<std::string>& options = std::vector<std::string>(), + const std::vector<std::string>& languages = std::vector<std::string>()); + + const std::string name; + const std::vector<std::string> options; + const std::vector<std::string> languages; +}; +typedef std::shared_ptr<TestConfiguration> TestConfigurationPtr; + +struct TestCase +{ + TestCase(const std::string&, const std::string&, const std::string&, const std::string& = "", + const std::string& = "", const std::string& = ""); + + const std::string name; + const std::string prefix; + const std::string client; + const std::string server; + const std::string serverAMD; + const std::string collocated; + bool sslSupport; + bool ipv6Support; + bool wsSupport; + std::vector<TestConfigurationPtr> configurations; +}; +typedef std::shared_ptr<TestCase> TestCasePtr; + +template<typename T> T^ +findChild(Windows::UI::Xaml::DependencyObject^ parent, Platform::String^ name) +{ + int count = VisualTreeHelper::GetChildrenCount(parent); + for (int i = 0; i < count; ++i) + { + DependencyObject^ object = VisualTreeHelper::GetChild(parent, i); + T^ child = dynamic_cast<T^>(object); + FrameworkElement^ element = dynamic_cast<FrameworkElement^>(object); + + if(child && element && element->Name == name) + { + return child; + } + else if(object) + { + child = findChild<T>(object, name); + if(child) + { + return child; + } + } + } + return nullptr; +} + [Windows::Foundation::Metadata::WebHostHidden] public ref class MainPage sealed { @@ -26,6 +84,7 @@ public: void completed(); void failed(Platform::String^ reason); + void printToConsoleOutput(Platform::String^ message, bool newline); protected: @@ -34,8 +93,39 @@ protected: private: void btnRun_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void btnStop_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void runSelectedTest(); + + void Output_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void Configuration_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void Tests_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void Language_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e); + + + std::string selectedLanguage(); + std::string selectedProtocol(); + void initializeSupportedProtocols(); + void initializeSupportedTests(); + + Ice::CommunicatorPtr communicator(); + Platform::Collections::Vector<Platform::String^>^ _names; + Platform::Collections::Vector<Platform::String^>^ _protocols; + Platform::Collections::Vector<Platform::String^>^ _messages; + + std::vector<TestCasePtr> _allTests; + + Windows::UI::Xaml::Controls::ListBox^ _tests; + Windows::UI::Xaml::Controls::ComboBox^ _language; + Windows::UI::Xaml::Controls::TextBox^ _host; + Windows::UI::Xaml::Controls::ComboBox^ _protocol; + Windows::UI::Xaml::Controls::CheckBox^ _loop; + Windows::UI::Xaml::Controls::CheckBox^ _serialize; + Windows::UI::Xaml::Controls::CheckBox^ _ipv6; + Windows::UI::Xaml::Controls::Button^ _run; + Windows::UI::Xaml::Controls::Button^ _stop; + Windows::UI::Xaml::Controls::ListBox^ _output; + Ice::CommunicatorPtr _communicator; }; } diff --git a/cpp/test/WinRT/TestSuite/TestSuite.vcxproj b/cpp/test/WinRT/TestSuite/TestSuite.vcxproj index 77fa4623414..010a59418f3 100644 --- a/cpp/test/WinRT/TestSuite/TestSuite.vcxproj +++ b/cpp/test/WinRT/TestSuite/TestSuite.vcxproj @@ -179,6 +179,7 @@ </ItemDefinitionGroup> <ItemGroup> <ClInclude Include="..\..\include\TestCommon.h" /> + <ClInclude Include="Controller.h" /> <ClInclude Include="pch.h" /> <ClInclude Include="App.xaml.h"> <DependentUpon>App.xaml</DependentUpon> @@ -376,6 +377,7 @@ <None Include="..\..\..\..\certs\cacert.der"> <DeploymentContent>true</DeploymentContent> </None> + <None Include="Controller.ice" /> <None Include="TestSuite_TemporaryKey.pfx" /> </ItemGroup> <ItemGroup> @@ -388,6 +390,7 @@ <ClCompile Include="App.xaml.cpp"> <DependentUpon>App.xaml</DependentUpon> </ClCompile> + <ClCompile Include="Controller.cpp" /> <ClCompile Include="MainPage.xaml.cpp"> <DependentUpon>MainPage.xaml</DependentUpon> </ClCompile> diff --git a/cpp/test/WinRT/TestSuite/TestSuite.vcxproj.filters b/cpp/test/WinRT/TestSuite/TestSuite.vcxproj.filters index d03de5397c3..b3968944559 100644 --- a/cpp/test/WinRT/TestSuite/TestSuite.vcxproj.filters +++ b/cpp/test/WinRT/TestSuite/TestSuite.vcxproj.filters @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <Filter Include="Common"> @@ -33,12 +33,14 @@ <ClCompile Include="App.xaml.cpp" /> <ClCompile Include="MainPage.xaml.cpp" /> <ClCompile Include="pch.cpp" /> + <ClCompile Include="Controller.cpp" /> </ItemGroup> <ItemGroup> <ClInclude Include="pch.h" /> <ClInclude Include="App.xaml.h" /> <ClInclude Include="MainPage.xaml.h" /> <ClInclude Include="..\..\include\TestCommon.h" /> + <ClInclude Include="Controller.h" /> </ItemGroup> <ItemGroup> <AppxManifest Include="Package.appxmanifest" /> @@ -232,8 +234,9 @@ <None Include="..\..\Ice\acm\Ice_acm_server.dll"> <Filter>Tests</Filter> </None> + <None Include="Controller.ice" /> </ItemGroup> <ItemGroup> <Page Include="MainPage.xaml" /> </ItemGroup> -</Project> +</Project>
\ No newline at end of file |