blob: 4bd9e2981f71e304bf8dac6744fe993417acb0bf (
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
// **********************************************************************
//
// Copyright (c) 2003-2017 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.
//
// **********************************************************************
using System;
using Test;
#if SILVERLIGHT
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
#endif
public class AllTests : TestCommon.TestApp
{
#if SILVERLIGHT
override
public void run(Ice.Communicator communicator)
#else
public static TestIntfPrx allTests(Ice.Communicator communicator)
#endif
{
Write("testing stringToProxy... ");
Flush();
string @ref = "test:default -p 12010";
Ice.ObjectPrx @base = communicator.stringToProxy(@ref);
test(@base != null);
WriteLine("ok");
Write("testing checked cast... ");
Flush();
TestIntfPrx obj = TestIntfPrxHelper.checkedCast(@base);
test(obj != null);
test(obj.Equals(@base));
WriteLine("ok");
#if !SILVERLIGHT
{
Write("creating/destroying/recreating object adapter... ");
Flush();
Ice.ObjectAdapter adapter =
communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default");
try
{
communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default");
test(false);
}
catch (Ice.AlreadyRegisteredException)
{
}
adapter.destroy();
//
// Use a different port than the first adapter to avoid an "address already in use" error.
//
adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default");
adapter.destroy();
Console.Out.WriteLine("ok");
}
#endif
Write("creating/activating/deactivating object adapter in one operation... ");
Flush();
obj.transient();
obj.end_transient(obj.begin_transient());
WriteLine("ok");
{
Write("testing connection closure... ");
Flush();
for(int i = 0; i < 10; ++i)
{
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = communicator.getProperties().ice_clone_();
Ice.Communicator comm = Ice.Util.initialize(initData);
comm.stringToProxy("test:default -p 12010").begin_ice_ping();
comm.destroy();
}
WriteLine("ok");
}
Write("deactivating object adapter in the server... ");
Flush();
obj.deactivate();
WriteLine("ok");
Write("testing whether server is gone... ");
Flush();
try
{
obj.ice_ping();
test(false);
}
catch(Ice.LocalException)
{
WriteLine("ok");
}
#if !SILVERLIGHT
return obj;
#endif
}
}
|