blob: b9c90f518be971f45cf270030ba88e577de7fdb0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// **********************************************************************
//
// 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.
//
// **********************************************************************
package test.Ice.properties;
public class Client extends test.Util.Application
{
public static void
test(boolean b)
{
if(!b)
{
throw new RuntimeException();
}
}
class PropertiesClient extends Ice.Application
{
public int
run(String[] args)
{
Ice.Properties properties = communicator().getProperties();
test(properties.getProperty("Ice.Trace.Network").equals("1"));
test(properties.getProperty("Ice.Trace.Protocol").equals("1"));
test(properties.getProperty("Config.Path").equals(configPath));
test(properties.getProperty("Ice.ProgramName").equals("PropertiesClient"));
test(appName().equals(properties.getProperty("Ice.ProgramName")));
return 0;
};
};
public int run(String[] args)
{
System.out.print("testing load properties from UTF-8 path... ");
Ice.InitializationData id = new Ice.InitializationData();
id.properties = Ice.Util.createProperties();
id.properties.load(configPath);
test(id.properties.getProperty("Ice.Trace.Network").equals("1"));
test(id.properties.getProperty("Ice.Trace.Protocol").equals("1"));
test(id.properties.getProperty("Config.Path").equals(configPath));
test(id.properties.getProperty("Ice.ProgramName").equals("PropertiesClient"));
System.out.println("ok");
System.out.print("testing load properties from UTF-8 path using Ice::Application... ");
PropertiesClient c = new PropertiesClient();
c.main("", args, configPath);
System.out.println("ok");
return 0;
}
public static void main(String[] args)
{
Client c = new Client();
int status = c.main("Client", args);
System.gc();
System.exit(status);
}
private static String configPath = "./config/\u4E2D\u56FD_client.config";
}
|