summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/operations/AllTests.cpp
blob: fe43ba9b31b7554ae5a5c9bfe6b40c9afa266afe (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
// **********************************************************************
//
// Copyright (c) 2003
// ZeroC, Inc.
// Billerica, MA, USA
//
// All Rights Reserved.
//
// Ice is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License version 2 as published by
// the Free Software Foundation.
//
// **********************************************************************

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

using namespace std;

Test::MyClassPrx
allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
    cout << "testing stringToProxy... " << flush;
    string ref = "test:default -p 12345 -t 2000";
    Ice::ObjectPrx base = communicator->stringToProxy(ref);
    test(base);
    cout << "ok" << endl;

    cout << "testing checked cast... " << flush;
    Test::MyClassPrx cl = Test::MyClassPrx::checkedCast(base);
    test(cl);
    Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(cl);
    test(derived);
    test(cl == base);
    test(derived == base);
    test(cl == derived);
    cout << "ok" << endl;

    cout << "testing twoway operations... " << flush;
    void twoways(const Test::MyClassPrx&);
    twoways(cl);
    twoways(derived);
    derived->opDerived();
    cout << "ok" << endl;

    if(!collocated)
    {
	cout << "testing twoway operations with AMI... " << flush;
	void twowaysAMI(const Test::MyClassPrx&);
	twowaysAMI(cl);
	twowaysAMI(derived);
	cout << "ok" << endl;
    }

    return cl;
}