summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/locationForward/AllTests.cpp
blob: 782166041604e7cb44eec23a5462745be6d75d4b (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
// **********************************************************************
//
// Copyright (c) 2001
// ZeroC, Inc.
// Huntsville, AL, USA
//
// All Rights Reserved
//
// **********************************************************************

#include <Ice/Ice.h>
#include <TestCommon.h>
#include <Test.h>

using namespace std;

void
allTests(const Ice::CommunicatorPtr& communicator, int port, int lastPort)
{
    cout << "testing stringToProxy... " << flush;
    ostringstream ref;
    ref << "test:default -t 2000 -p " << port;
    Ice::ObjectPrx base = communicator->stringToProxy(ref.str());
    test(base);
    ostringstream lastRef;
    lastRef << "test:default -t 2000 -p " << lastPort;
    Ice::ObjectPrx lastBase = communicator->stringToProxy(lastRef.str());
    test(lastBase);
    cout << "ok" << endl;

    cout << "testing checked cast... " << flush;
    TestPrx obj = TestPrx::checkedCast(base);
    test(obj);
    test(obj == base);
    TestPrx lastObj = TestPrx::checkedCast(lastBase);
    test(lastObj);
    test(lastObj == lastBase);
    cout << "ok" << endl;

    cout << "shutting down all servers with single call... " << flush;
    obj->shutdown();
    cout << "ok" << endl;

    cout << "testing whether all servers are gone... " << flush;
    try
    {
	lastObj->ice_ping();
	test(false);
    }
    catch(const Ice::LocalException&)
    {
	cout << "ok" << endl;
    }
}