blob: 3f895a300eb9af92b3db1cd8a5abee8d0184aed6 (
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
|
// **********************************************************************
//
// Copyright (c) 2003-2015 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.
//
// **********************************************************************
#import <objc/Ice.h>
#import <objc/Glacier2.h>
#import <objc/IceStorm.h>
#import <objc/IceGrid.h>
#import <TestCommon.h>
#import <ServicesTest.h>
#import <Foundation/Foundation.h>
@interface ClockI : TestServicesClock<TestServicesClock>
-(id) init;
-(void)tick:(NSString*)time current:(ICECurrent*)current;
@end
@implementation ClockI
-(id) init
{
self = [super init];
return self;
}
-(void)tick:(NSString*)time current:(ICECurrent*)current
{
NSLog(@"%@", time);
}
@end
void
servicesAllTests(id<ICECommunicator> communicator)
{
{
tprintf("testing Glacier2 stub... ");
@try
{
id<GLACIER2RouterPrx> router = [GLACIER2RouterPrx checkedCast:[communicator getDefaultRouter]];
[router createSession:@"" password:@""];
}
@catch(ICEException* ex)
{
test(NO);
}
tprintf("ok\n");
}
{
tprintf("testing IceStorm stub... ");
ICESTORMTopicManagerPrx* manager =
[ICESTORMTopicManagerPrx uncheckedCast:[communicator stringToProxy:@"test:default -p 12010"]];
ICESTORMQoS* qos;
ICESTORMTopicPrx* topic;
NSString* topicName = @"time";
id<ICEObjectAdapter> adapter = [communicator createObjectAdapterWithEndpoints:@"subscriber" endpoints:@"tcp"];
ICEObjectPrx* subscriber = [adapter addWithUUID:[ClockI clock]];
[adapter activate];
@try
{
topic = [manager retrieve:topicName];
[topic subscribeAndGetPublisher:qos subscriber:subscriber];
}
@catch(ICESTORMNoSuchTopic*)
{
test(NO);
}
@catch(ICESTORMAlreadySubscribed*)
{
test(NO);
}
@catch(ICELocalException*)
{
}
tprintf("ok\n");
}
{
tprintf("testing IceGrid stub... ");
ICEObjectPrx* base = [communicator stringToProxy:@"test:default -p 12010"];
ICEGRIDRegistryPrx* registry = [ICEGRIDRegistryPrx uncheckedCast:base];
ICEGRIDAdminSessionPrx* session;
ICEGRIDAdminPrx* admin;
@try
{
session = [registry createAdminSession:@"username" password:@"password"];
test(NO);
admin = [session getAdmin];
}
@catch(ICEGRIDPermissionDeniedException*)
{
test(NO);
}
@catch(ICELocalException*)
{
}
tprintf("ok\n");
}
}
|