ICE 3.4.2
[php5-ice-freebsdport.git] / java / test / Ice / properties / Client.java
blobf3a59eb66aee732fbe40030b776a12bce0de39e0
1 // **********************************************************************
2 //
3 // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
4 //
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
7 //
8 // **********************************************************************
10 package test.Ice.properties;
12 public class Client extends test.Util.Application
14 public static void
15 test(boolean b)
17 if(!b)
19 throw new RuntimeException();
23 class PropertiesClient extends Ice.Application
25 public int
26 run(String[] args)
28 Ice.Properties properties = communicator().getProperties();
29 test(properties.getProperty("Ice.Trace.Network").equals("1"));
30 test(properties.getProperty("Ice.Trace.Protocol").equals("1"));
31 test(properties.getProperty("Config.Path").equals(configPath));
32 test(properties.getProperty("Ice.ProgramName").equals("PropertiesClient"));
33 test(appName().equals(properties.getProperty("Ice.ProgramName")));
34 return 0;
38 public int run(String[] args)
40 System.out.print("testing load properties from UTF-8 path... ");
41 Ice.InitializationData id = new Ice.InitializationData();
42 id.properties = Ice.Util.createProperties();
43 id.properties.load(configPath);
44 test(id.properties.getProperty("Ice.Trace.Network").equals("1"));
45 test(id.properties.getProperty("Ice.Trace.Protocol").equals("1"));
46 test(id.properties.getProperty("Config.Path").equals(configPath));
47 test(id.properties.getProperty("Ice.ProgramName").equals("PropertiesClient"));
48 System.out.println("ok");
49 System.out.print("testing load properties from UTF-8 path using Ice::Application... ");
50 PropertiesClient c = new PropertiesClient();
51 c.main("", args, configPath);
52 System.out.println("ok");
53 return 0;
56 public static void main(String[] args)
58 Client c = new Client();
59 int status = c.main("Client", args);
60 System.gc();
61 System.exit(status);
64 private static String configPath = "./config/\u4E2D\u56FD_client.config";