diff options
author | Jose <jose@zeroc.com> | 2011-04-12 19:35:15 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2011-04-12 19:35:15 +0200 |
commit | 8ad1861d2f5753883eed83842b56440068ba42ed (patch) | |
tree | 86af7653703b5b5ea14f3b07d3f7090ad9b66552 /cpp/test/Ice/properties/Client.cpp | |
parent | Added missing .gitignore (diff) | |
download | ice-8ad1861d2f5753883eed83842b56440068ba42ed.tar.bz2 ice-8ad1861d2f5753883eed83842b56440068ba42ed.tar.xz ice-8ad1861d2f5753883eed83842b56440068ba42ed.zip |
5009 - appName incosistence
Also improve properties test
Diffstat (limited to 'cpp/test/Ice/properties/Client.cpp')
-rwxr-xr-x | cpp/test/Ice/properties/Client.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/cpp/test/Ice/properties/Client.cpp b/cpp/test/Ice/properties/Client.cpp new file mode 100755 index 00000000000..3f605a3a47a --- /dev/null +++ b/cpp/test/Ice/properties/Client.cpp @@ -0,0 +1,74 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <IceUtil/FileUtil.h> + +using namespace std; + +namespace +{ + +string configPath; + +class Client : public Ice::Application +{ +public: + virtual int + run(int, char*[]) + { + Ice::PropertiesPtr properties = communicator()->getProperties(); + test(properties->getProperty("Ice.Trace.Network") == "1"); + test(properties->getProperty("Ice.Trace.Protocol") == "1"); + test(properties->getProperty("Config.Path") == configPath); + test(properties->getProperty("Ice.ProgramName") == "PropertiesClient"); + test(appName() == properties->getProperty("Ice.ProgramName")); + return EXIT_SUCCESS; + }; +}; + +} + +int +main(int argc, char* argv[]) +{ + ifstream in("./config/configPath"); + if(!in) + { + test(false); + } + + if(!getline(in, configPath)) + { + test(false); + } + try + { + cout << "testing load properties from UTF-8 path... " << flush; + Ice::InitializationData id; + id.properties = Ice::createProperties(); + id.properties->load(configPath); + test(id.properties->getProperty("Ice.Trace.Network") == "1"); + test(id.properties->getProperty("Ice.Trace.Protocol") == "1"); + test(id.properties->getProperty("Config.Path") == configPath); + test(id.properties->getProperty("Ice.ProgramName") == "PropertiesClient"); + cout << "ok" << endl; + } + catch(const Ice::Exception& ex) + { + cerr << ex << endl; + return EXIT_FAILURE; + } + cout << "testing load properties from UTF-8 path using Ice::Application... " << flush; + Client c; + c.main(argc, argv, configPath.c_str()); + cout << "ok" << endl; + return EXIT_SUCCESS; +}
\ No newline at end of file |